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
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

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

CursorLoader

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.

CursorLoader

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() 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: Deprecated in Java.

deliverResult

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

Deprecated: Deprecated in Java.

Parameters
data the result of the load

dump

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

Deprecated: Deprecated in Java.

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
open fun getProjection(): Array<String!>!

Deprecated: Deprecated in Java.

getSelection

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

Deprecated: Deprecated in Java.

getSelectionArgs

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

Deprecated: Deprecated in Java.

getSortOrder

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

Deprecated: Deprecated in Java.

getUri

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

Deprecated: Deprecated in Java.

loadInBackground

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

Deprecated: Deprecated in Java.

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
open fun onCanceled(cursor: Cursor!): Unit

Deprecated: Deprecated in Java.

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

setProjection

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

Deprecated: Deprecated in Java.

setSelection

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

Deprecated: Deprecated in Java.

setSelectionArgs

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

Deprecated: Deprecated in Java.

setSortOrder

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

Deprecated: Deprecated in Java.

setUri

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

Deprecated: Deprecated in Java.

Protected methods

onReset

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

Deprecated: Deprecated in Java.

onStartLoading

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

Deprecated: Deprecated in Java.

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
protected open fun onStopLoading(): Unit

Deprecated: Deprecated in Java.

Must be called from the UI thread