Google is committed to advancing racial equity for Black communities. See how.
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(android.content.Context,android.net.Uri,java.lang.String[],java.lang.String,java.lang.String[],java.lang.String) or creating an empty instance with CursorLoader(android.content.Context) and filling in the desired parameters with setUri(android.net.Uri), setSelection(java.lang.String), setSelectionArgs(java.lang.String[]), setSortOrder(java.lang.String), and setProjection(java.lang.String[]).

Summary

Public constructors

<init>(context: Context!)

Creates an empty unspecified CursorLoader.

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

Creates a fully-specified CursorLoader.

Public methods

open Unit

open Unit

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

open Array<String!>!

open String!

open Array<String!>!

open String!

open Uri!

open Cursor!

open Unit
onCanceled(cursor: Cursor!)

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

open Unit

Starts an asynchronous load of the data.

open Unit

Must be called from the UI thread

Inherited functions

Public constructors

<init>

Added in API level 11
CursorLoader(context: Context!)

Creates an empty unspecified CursorLoader. You must follow this with calls to setUri(android.net.Uri), setSelection(java.lang.String), etc to specify the query to perform.

<init>

Added in API level 11
CursorLoader(
    context: Context!,
    uri: Uri!,
    projection: Array<String!>!,
    selection: String!,
    selectionArgs: Array<String!>!,
    sortOrder: String!)

Creates a fully-specified CursorLoader. See ContentResolver#query(Uri, String[], String, String[], String) for documentation on the meaning of the parameters. These will be passed as-is to that call.

Public methods

cancelLoadInBackground

Added in API level 16
Deprecated in API level 28
open fun cancelLoadInBackground(): Unit

Deprecated.

deliverResult

Added in API level 11
Deprecated in API level 28
open fun deliverResult(cursor: Cursor!): Unit

Deprecated.

Parameters
data the result of the load

dump

Added in API level 11
Deprecated in API level 28
open fun dump(
    prefix: String!,
    fd: FileDescriptor!,
    writer: PrintWriter!,
    args: Array<String!>!
): Unit

Deprecated.

Parameters
prefix String!: Text to print at the front of each line.
fd FileDescriptor!: The raw file descriptor that the dump is being sent to.
writer PrintWriter!: A PrintWriter to which the dump is to be set.
args Array<String!>!: Additional arguments to the dump request.

getProjection

Added in API level 11
Deprecated in API level 28
open fun getProjection(): Array<String!>!

Deprecated.

getSelection

Added in API level 11
Deprecated in API level 28
open fun getSelection(): String!

Deprecated.

getSelectionArgs

Added in API level 11
Deprecated in API level 28
open fun getSelectionArgs(): Array<String!>!

Deprecated.

getSortOrder

Added in API level 11
Deprecated in API level 28
open fun getSortOrder(): String!

Deprecated.

getUri

Added in API level 11
Deprecated in API level 28
open fun getUri(): Uri!

Deprecated.

loadInBackground

Added in API level 11
Deprecated in API level 28
open fun loadInBackground(): Cursor!

Deprecated.

Return
Cursor! The result of the load operation.
Exceptions
android.os.OperationCanceledException if the load is canceled during execution.

onCanceled

Added in API level 11
Deprecated in API level 28
open fun onCanceled(cursor: Cursor!): Unit

Deprecated.

Parameters
data The value that was returned by loadInBackground, or null if the task threw OperationCanceledException.

setProjection

Added in API level 11
Deprecated in API level 28
open fun setProjection(projection: Array<String!>!): Unit

Deprecated.

setSelection

Added in API level 11
Deprecated in API level 28
open fun setSelection(selection: String!): Unit

Deprecated.

setSelectionArgs

Added in API level 11
Deprecated in API level 28
open fun setSelectionArgs(selectionArgs: Array<String!>!): Unit

Deprecated.

setSortOrder

Added in API level 11
Deprecated in API level 28
open fun setSortOrder(sortOrder: String!): Unit

Deprecated.

setUri

Added in API level 11
Deprecated in API level 28
open fun setUri(uri: Uri!): Unit

Deprecated.

Protected methods

onReset

Added in API level 11
Deprecated in API level 28
protected open fun onReset(): Unit

Deprecated.

onStartLoading

Added in API level 11
Deprecated in API level 28
protected open fun onStartLoading(): Unit

Deprecated.

Starts an asynchronous load of the data. When the result is ready the callbacks will be called on the UI thread. If a previous load has been completed and is still valid the result may be passed to the callbacks immediately. Must be called from the UI thread

onStopLoading

Added in API level 11
Deprecated in API level 28
protected open fun onStopLoading(): Unit

Deprecated.

Must be called from the UI thread