added in version 22.1.0
belongs to Maven artifact


public class CursorLoader
extends AsyncTaskLoader<Cursor>


Static library support version of the framework's CursorLoader. Used to write apps that run on platforms prior to Android 3.0. When running on Android 3.0 or above, this implementation is still used; it does not try to switch to the framework's implementation. See the framework SDK documentation for a class overview.


Public constructors

CursorLoader(Context context)

Creates an empty unspecified CursorLoader.

CursorLoader(Context context, Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder)

Creates a fully-specified CursorLoader.

Public methods

void cancelLoadInBackground()

Called on the main thread to abort a load in progress.

void deliverResult(Cursor cursor)

Sends the result of the load to the registered listener.

void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args)

Print the Loader's state into the given stream.

String[] getProjection()
String getSelection()
String[] getSelectionArgs()
String getSortOrder()
Uri getUri()
Cursor loadInBackground()

Called on a worker thread to perform the actual load and to return the result of the load operation.

void onCanceled(Cursor cursor)

Called if the task was canceled before it was completed.

void setProjection(String[] projection)
void setSelection(String selection)
void setSelectionArgs(String[] selectionArgs)
void setSortOrder(String sortOrder)
void setUri(Uri uri)

Protected methods

void onReset()

Subclasses must implement this to take care of resetting their loader, as per reset().

void onStartLoading()

Starts an asynchronous load of the contacts list data.

void onStopLoading()

Must be called from the UI thread

Inherited methods

From class