Code example for Loader

Methods: getId

0
    } 
 
    @Override 
    public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
         
        switch (loader.getId()) {
        case THUMBNAIL_LOADER_ID:
            // Swap adapter cursor to show new data 
            adapter.swapCursor(cursor);
            break; 
             
        case FULL_PICTURE_LOADER_ID:
            // Get data from cursor 
            cursor.moveToFirst();
            String uri = cursor.getString(cursor.getColumnIndex(MediaStore.Images.Media.DATA));
            Intent i = createResult(uri);
            // Return success to caller 
            setResult(RESULT_OK, i);
            finish();
            break; 
Experience pair programming with AI  Get Codota for Java