/** {@inheritDoc} */ @Override public void onLoaderReset(final 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); }
/** {@inheritDoc} */ @Override public void onLoadFinished(final Loader<Cursor> loader, final Cursor data) { if (data == null || data.isClosed() || data.getCount() <= 0) { // Set the empty text final TextView empty = (TextView) findViewById(R.id.empty); empty.setText(getString(R.string.empty_search)); mGridView.setEmptyView(empty); return; } // Swap the new cursor in. (The framework will take care of closing the // old cursor once we return.) mAdapter.swapCursor(data); }