title: Android - ListView not refreshing
body: <p>I have a fragment class containg a button and Listview, when the button is clicked a DialogFragment will appear ontop of the fragment class. It will take the users input and add it into a database, everything works however the listview does not update, I know I need to call adapter.notifyDataChange() I will write the psudeo code.</p>
  
  <pre><code> public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
      View view = inflater.inflate(R.layout.fragment_notes, container, false);
  
      add = (Button) view.findViewById(R.id.button1);
  
      add.setOnClickListener(new View.OnClickListener() {
          public void onClick(View v) {
              //New DialogFragment show.dialog
  
          }
      });
  
      filllist(view);
  
      return view;
  }
  </code></pre>
  
  <p>Another class, the creation of my DialogFragment</p>
  
  <pre><code>public Dialog onCreateDialog(Bundle savedInstanceState){
  
  
      final AlertDialog.Builder dialog = new AlertDialog.Builder(getActivity());
  
      final View view = getActivity().getLayoutInflater().inflate(R.layout.custom_layout, null);
      build.setView(view);
  
      build.setPositiveButton(R.string.add, new DialogInterface.OnClickListener() {
          @Override
          public void onClick(DialogInterface dialog, int which) {
              final String text = ((EditText) view.findViewById(R.id.randomtext)).getText().toString();
  
  
                  //Call insert method of database helper. pass user input
                  //dismiss 
                  adapter.notifyDataSetChanged();
  
  
          }
      });
  
      build.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
          @Override
          public void onClick(DialogInterface dialog, int which) {
              dismiss();
          }
      });
  
      return dialog.create();
  
  }
  </code></pre>
  
  <p>When the user finishes filling in editText fields and presses add inserts data in database and dismisses dialogFragment but it does not update/refresh the listview, where can I call notifyDataSetChanged();</p>