code: public Cursor swapCursor(Cursor newCursor) {
          if (newCursor == mCursor) {
              return null;
          }
          Cursor oldCursor = mCursor;
          if (oldCursor != null) {
              if (mChangeObserver != null) oldCursor.unregisterContentObserver(mChangeObserver);
              if (mDataSetObserver != null) oldCursor.unregisterDataSetObserver(mDataSetObserver);
          }
          mCursor = newCursor;
          if (newCursor != null) {
              if (mChangeObserver != null) newCursor.registerContentObserver(mChangeObserver);
              if (mDataSetObserver != null) newCursor.registerDataSetObserver(mDataSetObserver);
              mRowIDColumn = newCursor.getColumnIndexOrThrow("_id");
              mDataValid = true;
              // notify the observers about the new cursor
              notifyDataSetChanged();
          } else {
              mRowIDColumn = -1;
              mDataValid = false;
              // notify the observers about the lack of a data set
              notifyDataSetInvalidated();
          }
          return oldCursor;
      }
docs: Swap in a new Cursor, returning the old Cursor.  Unlike
  {@link #changeCursor(Cursor)}, the returned old Cursor is <em>not</em>
  closed.
  
  @param newCursor The new cursor to be used.
  @return Returns the previously set Cursor, or null if there was not one.
  If the given new Cursor is the same instance is the previously set
  Cursor, null is also returned.