title: Perform adapter.notifyDataSetChanged() outside a Fragment
body: <p>I have one fragment that is a list of database values. I am using a ListView to display the values to the screen.</p>
  
  <p>I have another fragment that contains the buttons to add entries to the database. So my problem is, is that when I add an entry to the database by hitting a button on the first fragment, I need the second fragment (or second page in the app) to update the list of database values that are shown on the screen.</p>
  
  <p>Here is the database list fragment:</p>
  
  <pre><code>public class FragManage extends Fragment {
  
  private PunchesDataSource datasource;
  
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
      Bundle savedInstanceState) {
  
      datasource = new PunchesDataSource(getActivity());
      datasource.open();
  
      List&lt;Punch&gt; values = datasource.getAllPunches();
  
      // Use the SimpleCursorAdapter to show the elements in a ListView
      ArrayAdapter&lt;Punch&gt; adapter = new ArrayAdapter&lt;Punch&gt;(getActivity(),
          android.R.layout.simple_list_item_1, values);
  
      View myFragmentView = inflater.inflate(R.layout.fragment_manage, container, false);
  
      ListView list = (ListView) myFragmentView.findViewById(R.id.list);
      list.setAdapter(adapter);
  
      return myFragmentView;
      }
  }
  </code></pre>
  
  <p>So I just want to perform adapter.notifyDataSetChanged() in my other fragment that contains the buttons (something like this):</p>
  
  <pre><code>    // Punch OUT button.
      Button out_button = (Button) myFragmentView.findViewById(R.id.out_button);
      out_button.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              datasource.createPunch("out-" + getTime());
  
              FragManage.adapter.notifyDataSetChanged();
          }
        });
  </code></pre>