Code example for Loader

Methods: getId

0
                return new CursorLoader(CallLogActivity.this, CallLog.Calls.CONTENT_URI, projection, null, null, null);
            } 
 
            @Override 
            public void onLoadFinished(Loader<Cursor> cursorLoader, Cursor cursor) {
                switch (cursorLoader.getId()) {
                    case LOADER_ID:
                        // The asynchronous load is complete and the data 
                        // is now available for use. Only now can we associate 
                        // the queried Cursor with the SimpleCursorAdapter. 
                        adapter.swapCursor(cursor);
                        break; 
                } 
            } 
 
            @Override 
            public void onLoaderReset(Loader<Cursor> cursorLoader) {
                adapter.swapCursor(null);
            } 
        };