Save the date! Android Dev Summit is coming to Sunnyvale, CA on Oct 23-24, 2019.

CursorLoader

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

Static library support version of the framework's android.content.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.

Summary

Public constructors
<init>(@NonNull context: Context)

Creates an empty unspecified CursorLoader.

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

Creates a fully-specified CursorLoader.

Public methods
open Array<String!>?

open Uri

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

open Array<String!>?

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

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

open Unit
setUri(@NonNull uri: Uri)

open Unit

open Unit
setSelection(@Nullable selection: String?)

open Cursor?

open Unit
setSortOrder(@Nullable sortOrder: String?)

open String?

open Unit

open Unit
onCanceled(cursor: Cursor?)

open String?

Protected methods
open Unit

Starts an asynchronous load of the contacts list data.

open Unit

open Unit

Must be called from the UI thread

Inherited functions

Public constructors

<init>

CursorLoader(@NonNull context: Context)

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

<init>

CursorLoader(@NonNull context: Context, @NonNull uri: Uri, @Nullable projection: Array<String!>?, @Nullable selection: String?, @Nullable selectionArgs: Array<String!>?, @Nullable 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

getProjection

@Nullable open fun getProjection(): Array<String!>?

getUri

@NonNull open fun getUri(): Uri

setProjection

open fun setProjection(@Nullable projection: Array<String!>?): Unit

getSelectionArgs

@Nullable open fun getSelectionArgs(): Array<String!>?

dump

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

Deprecated:

setSelectionArgs

open fun setSelectionArgs(@Nullable selectionArgs: Array<String!>?): Unit

setUri

open fun setUri(@NonNull uri: Uri): Unit

deliverResult

open fun deliverResult(cursor: Cursor?): Unit

setSelection

open fun setSelection(@Nullable selection: String?): Unit

loadInBackground

open fun loadInBackground(): Cursor?

setSortOrder

open fun setSortOrder(@Nullable sortOrder: String?): Unit

getSortOrder

@Nullable open fun getSortOrder(): String?

cancelLoadInBackground

open fun cancelLoadInBackground(): Unit

onCanceled

open fun onCanceled(cursor: Cursor?): Unit

getSelection

@Nullable open fun getSelection(): String?

Protected methods

onStartLoading

protected open fun onStartLoading(): Unit

Starts an asynchronous load of the contacts list 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

onReset

protected open fun onReset(): Unit

onStopLoading

protected open fun onStopLoading(): Unit

Must be called from the UI thread