public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
    // Swap the new cursor in. (The framework will take care of closing the
    // old cursor once we return.)
    mAdapter.swapCursor(data);

    // The list should now be shown.
    if (isResumed()) {
      setListShown(true);
    } else {
      setListShownNoAnimation(true);
    }
  }
 public void onLoaderReset(Loader<Cursor> loader) {
   // This is called when the last Cursor provided to onLoadFinished()
   // above is about to be closed. We need to make sure we are no
   // longer using it.
   mAdapter.swapCursor(null);
 }