title: How update ListView in ListFragment from FragmentActivity?
body: <p>I'm using a ListFragment within an FragmentActivity together with a SimpleCursorAdapter and a modified CursorLoader. The modified CursorLoader simply issues rawQueries - no other changes.</p>
  
  <p>At some point in the FragmentActivity I need to refetch the data/cursor that feeds the ListView in the ListFragment.</p>
  
  <p>How can I do that?</p>
  
  <p>Many thanks in advance.</p>
  
  <p>Here's the FragmentActivity calling a method in the ListFragment:</p>
  
  <pre><code>public class ActivityList extends FragmentActivity {
  
      @Override
      protected void onActivityResult(final int requestCode, final int resultCode, final Intent intent) {
          ...
          processUpdateList();
      }
  
      ...
  
      private void processUpdateList() {
          Fragment fragment = getSupportFragmentManager().findFragmentById(R.id.fragmentlist);
          if (fragment != null) {
              ((FragmentList) fragment).requeryList();
          }
      }
  }
  </code></pre>
  
  <p>And here's the ListFragment with the method that should initiate a re-query, re-load or re-paint of the ListView. ListView.invalidate() did not help - it did not change the shown data.</p>
  
  <pre><code>public class FragmentList extends ListFragment implements LoaderManager.LoaderCallbacks&lt;Cursor&gt; {
  
      private SimpleCursorAdapter adapter;
      private Context             context;
      private ListView            listView;
  
      public void requeryList() {
      // listView.invalidate(); didn't re-query
          // TODO: How???
      }
  
      @Override
      public void onActivityCreated(final Bundle bundle) {
          super.onActivityCreated(bundle);
  
          context = getActivity().getApplicationContext();
  
          listView = getListView();
  
          getActivity().getSupportLoaderManager().initLoader(MyConstants.LDR_TABLE1LIST, null, this);
  
          adapter = new SimpleCursorAdapter(context,
                                            R.layout.fragmentlist_row,
                                            null,
                                            new String[] { Table1.DESCRIPTION },
                                            new int[] { R.id.fragmentlist_row_description },
                                            CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER);
          setListAdapter(adapter);
          setListShown(false);
  
          listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
      }
  
      @Override
      public Loader&lt;Cursor&gt; onCreateLoader(final int id, final Bundle bundle) {
          MyCursorLoader loader = null;
  
          switch (id) {
              case MyConstants.LDR_TABLE1LIST:
                  loader = new MyCursorLoader(context,
                                              MySQLiteOpenHelper.TABLE1_FETCH,
                                              null);
                  break;
          }
  
          return loader;
      }
  
      @Override
      public void onLoaderReset(final Loader&lt;Cursor&gt; loader) {
          adapter.swapCursor(null);
      }
  
      @Override
      public void onLoadFinished(final Loader&lt;Cursor&gt; loader, final Cursor cursor) {
          adapter.swapCursor(cursor);
  
          setListShown(true);
      }
  }
  </code></pre>