Code example for LoaderManager

Methods: getLoader, restartLoader

0
 
        loadPlaylists(); 
    } 
 
    protected void loadPlaylists() { 
        Loader<Cursor> loader = mLoaderManager.getLoader(ID_PLAYLIST_LOADER);
 
        Bundle args = new Bundle();
        if (loader != null) {
            mLoaderManager.restartLoader(ID_PLAYLIST_LOADER, args, mLoaderCallbacks);
        } else { 
            mLoaderManager.initLoader(ID_PLAYLIST_LOADER, args, mLoaderCallbacks);
        } 
    } 
 
    private static final class PlaylistCursorLoader extends CursorLoader {
 
        private static final String[] PROJECTION = new String[] {
            MediaStore.Audio.Playlists._ID,
            MediaStore.Audio.Playlists.NAME
        };