title: notifyDataSetChanged() not working in ListFragment
body: <p>I have a <code>ListView</code> in a <code>ListFragment</code> that is populated via a database query. It loads all the data just fine when it first populates the list in <code>onCreate()</code>. But when I requery the database, assign the return value to <code>assignmentsCursor</code>, and call <code>notifyDataSetChanged()</code>, it doesn't update <code>adapter.mCursor</code>. If I go into the Debugging mode in Eclipse I can see that <code>assignmentsCursor.mCount</code> has changed, but when I look at <code>adapter.mCursor.mCount</code>, it's the same as before. (Yes, I'm checking <em>after</em> notifyDataSetChanged() has been called.)</p>
  
  <p>The relevant parts of my code:</p>
  
  <pre><code>SimpleCursorAdapter adapter;
  Cursor assignmentsCursor;
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      if (savedInstanceState != null) {
          course = savedInstanceState.getShort(Values.ASSIGNMENT_KEY_COURSE);
      }
      setRetainInstance(true);
  
      // Create and array to specify the fields we want
      String[] from = new String[] { Values.KEY_TITLE, Values.ASSIGNMENT_KEY_COURSE };
  
      // and an array of the fields we want to bind in the view
      int[] to = new int[] { R.id.assignment_list_title, R.id.assignment_list_course };
  
      // Need to give assignmentsCursor a value -- null will make it not work
      updateAdapter();
  
      adapter = new SimpleCursorAdapter(context, R.layout.assignment_list_item, assignmentsCursor, from, to);
      setListAdapter(adapter);
  }
  
  public void onResume() {
      super.onResume();
      updateAdapter();
      refresh();
  }
  
  /**
   * Updates the content in the adapter.
   */
  public void updateAdapter() {
      SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
      boolean showingCompleted = sharedPrefs.getBoolean(Values.ASSIGNMENT_KEY_SHOWING_COMPLETED, false);
  
      if (course &lt; 0) // Showing assignments from all courses
          if (showingCompleted)
              assignmentsCursor = DbUtils.fetchAllAssignments(context, Values.ASSIGNMENT_LIST_FETCH, null, true);
          else
              assignmentsCursor = DbUtils.fetchIncompleteAssignments(context, Values.ASSIGNMENT_LIST_FETCH, null, true);
      else // Showing assignments from specified course
          if (showingCompleted)
              assignmentsCursor = DbUtils.fetchAllAssignments(context, Values.ASSIGNMENT_LIST_FETCH, course, true);
          else
              assignmentsCursor = DbUtils.fetchIncompleteAssignments(context, Values.ASSIGNMENT_LIST_FETCH, course, true);
  
  }
  
  private void refresh() {
      updateAdapter();
      adapter.notifyDataSetChanged();
  }
  </code></pre>
  
  <p>Help me!! ;)</p>
  
  <p>P.S. If you need any more details/code, just let me know. I am positive that the database is querying correctly though.</p>