Code example for LoaderManager

Methods: getLoader, restartLoader

0
 
        loadAlbums(); 
    } 
 
    protected void loadAlbums() { 
        Loader<Cursor> loader = mLoaderManager.getLoader(ID_ALBUM_LOADER);
 
        Bundle args = new Bundle();
        if (loader != null) {
            mLoaderManager.restartLoader(ID_ALBUM_LOADER, args, mLoaderCallbacks);
        } else { 
            mLoaderManager.initLoader(ID_ALBUM_LOADER, args, mLoaderCallbacks);
        } 
    } 
 
    private static final class AlbumCursorLoader extends CursorLoader {
 
        private static final String[] PROJECTION = new String[] {
            MediaStore.Audio.Albums._ID,
            MediaStore.Audio.Albums.ALBUM,
            MediaStore.Audio.Albums.ARTIST,