Added in API level 11
Deprecated in API level 28

CursorLoader


open class CursorLoader : AsyncTaskLoader<Cursor!>
kotlin.Any
   ↳ android.content.Loader<D>
   ↳ android.content.AsyncTaskLoader<android.database.Cursor>
   ↳ android.content.CursorLoader

A loader that queries the ContentResolver and returns a Cursor. This class implements the Loader protocol in a standard way for querying cursors, building on AsyncTaskLoader to perform the cursor query on a background thread so that it does not block the application's UI.

A CursorLoader must be built with the full information for the query to perform, either through the CursorLoader(Context,Uri,String[],String,String[],String) or creating an empty instance with CursorLoader(Context) and filling in the desired parameters with setUri(Uri), setSelection(String), setSelectionArgs(String[]), setSortOrder(String), and setProjection(String[]).

Summary

Public constructors
CursorLoader(context: Context!)

Creates an empty unspecified CursorLoader.

CursorLoader(context: Context!, uri: Uri!, projection: Array<String!>!, selection: String!, selectionArgs: Array<String!>!, sortOrder: String!)

Creates a fully-specified CursorLoader.

Public methods
open Unit

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

open Unit

Sends the result of the load to the registered listener.

open Unit
dump(prefix: String!, fd: FileDescriptor!, writer: PrintWriter!, args: Array<String!>!)

Print the Loader's state into the given stream.

open Array<String!>!

open String!

open Array<String!>!

open String!

open Uri!

open Cursor!

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

open Unit
onCanceled(cursor: Cursor!)

Called if the task was canceled before it was completed.

open Unit
setProjection(projection: Array<String!>!)

open Unit
setSelection(selection: String!)

open Unit
setSelectionArgs(selectionArgs: Array<String!>!)

open Unit
setSortOrder(sortOrder: String!)

open Unit
setUri(uri: Uri!)

Protected methods
open Unit

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

open Unit

Starts an asynchronous load of the data.

open Unit

Must be called from the UI thread

Inherited functions