@Override public void onLoaderReset(Loader<Cursor> loader) { switch (loader.getId()) { case TRACKS_LOADER_ID: mCursorAdapter.swapCursor(null); mCursor = null; break; default: break; } }
@Override public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) { switch (loader.getId()) { case TRACKS_LOADER_ID: Log.v(LOG_TAG, "onLoadFinished"); mCursorAdapter.swapCursor(cursor); mCursor = cursor; // Check if we have the artist and tracks loaded in the player // if so, highlight that track if (!highlightCurrentTrack()) { if (mPosition != ListView.INVALID_POSITION) { // If we don't need to restart the loader, and there's a desired position to // restore to, do so mTracksListView.smoothScrollToPosition(mPosition); mTracksListView.setSelection(mPosition); mTracksListView.setItemChecked(mPosition, true); } else if (cursor.getCount() > 0) mTracksListView.smoothScrollToPosition(0); } break; default: break; } }