# CursorLoader

Artifact: [androidx.loader:loader](https://developer.android.com/jetpack/androidx/releases/loader) [View Source](https://cs.android.com/search?q=file:androidx/loader/content/CursorLoader.java+class:androidx.loader.content.CursorLoader) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/loader#1.0.0)

*** ** * ** ***


```
class CursorLoader : AsyncTaskLoader<Cursor!>
```

<br />

|---|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html) ||||
| ↳ | [androidx.loader.content.Loader](https://developer.android.com/reference/kotlin/androidx/loader/content/Loader) |||
|   | ↳ | [androidx.loader.content.AsyncTaskLoader](https://developer.android.com/reference/kotlin/androidx/loader/content/AsyncTaskLoader)\<[Cursor](https://developer.android.com/reference/android/database/Cursor.html)!\> ||
|   |   | ↳ | [androidx.loader.content.CursorLoader](https://developer.android.com/reference/kotlin/androidx/loader/content/CursorLoader) |

*** ** * ** ***

Static library support version of the framework's `https://developer.android.com/reference/android/content/CursorLoader.html`. 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 |
|---|
| `https://developer.android.com/reference/kotlin/androidx/loader/content/CursorLoader#CursorLoader(android.content.Context)(context: https://developer.android.com/reference/android/content/Context.html)` Creates an empty unspecified CursorLoader. |
| `https://developer.android.com/reference/kotlin/androidx/loader/content/CursorLoader#CursorLoader(android.content.Context,android.net.Uri,java.lang.String[],java.lang.String,java.lang.String[],java.lang.String)( context: https://developer.android.com/reference/android/content/Context.html, uri: https://developer.android.com/reference/android/net/Uri.html, projection: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>?, selection: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?, selectionArgs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>?, sortOrder: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html? )` Creates a fully-specified CursorLoader. |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/loader/content/CursorLoader#cancelLoadInBackground()()` Called on the main thread to abort a load in progress. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/loader/content/CursorLoader#deliverResult(android.database.Cursor)(data: https://developer.android.com/reference/android/database/Cursor.html?)` Sends the result of the load to the registered listener. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `[dump](https://developer.android.com/reference/kotlin/androidx/loader/content/CursorLoader#dump(java.lang.String,java.io.FileDescriptor,java.io.PrintWriter,java.lang.String[]))( prefix: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, fd: https://developer.android.com/reference/java/io/FileDescriptor.html?, writer: https://developer.android.com/reference/java/io/PrintWriter.html, args: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>? )` **This function is deprecated.** Consider using `https://developer.android.com/reference/kotlin/androidx/loader/app/LoaderManager#enableDebugLogging(boolean)` to understand the series of operations performed by LoaderManager. <br /> |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>?` | `https://developer.android.com/reference/kotlin/androidx/loader/content/CursorLoader#getProjection()()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` | `https://developer.android.com/reference/kotlin/androidx/loader/content/CursorLoader#getSelection()()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>?` | `https://developer.android.com/reference/kotlin/androidx/loader/content/CursorLoader#getSelectionArgs()()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` | `https://developer.android.com/reference/kotlin/androidx/loader/content/CursorLoader#getSortOrder()()` |
| `https://developer.android.com/reference/android/net/Uri.html` | `https://developer.android.com/reference/kotlin/androidx/loader/content/CursorLoader#getUri()()` |
| `https://developer.android.com/reference/android/database/Cursor.html?` | `https://developer.android.com/reference/kotlin/androidx/loader/content/CursorLoader#loadInBackground()()` Called on a worker thread to perform the actual load and to return the result of the load operation. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/loader/content/CursorLoader#onCanceled(android.database.Cursor)(data: https://developer.android.com/reference/android/database/Cursor.html?)` Called if the task was canceled before it was completed. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/loader/content/CursorLoader#setProjection(java.lang.String[])(projection: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>?)` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/loader/content/CursorLoader#setSelection(java.lang.String)(selection: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?)` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/loader/content/CursorLoader#setSelectionArgs(java.lang.String[])(selectionArgs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>?)` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/loader/content/CursorLoader#setSortOrder(java.lang.String)(sortOrder: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?)` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/loader/content/CursorLoader#setUri(android.net.Uri)(uri: https://developer.android.com/reference/android/net/Uri.html)` |

| ### Protected functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/loader/content/CursorLoader#onReset()()` Subclasses must implement this to take care of resetting their loader, as per `https://developer.android.com/reference/kotlin/androidx/loader/content/Loader#reset()`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/loader/content/CursorLoader#onStartLoading()()` Starts an asynchronous load of the contacts list data. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/loader/content/CursorLoader#onStopLoading()()` Must be called from the UI thread |

### Inherited functions

From [androidx.loader.content.AsyncTaskLoader](https://developer.android.com/reference/kotlin/androidx/loader/content/AsyncTaskLoader) `https://developer.android.com/reference/java/util/concurrent/Executor.html` `https://developer.android.com/reference/kotlin/androidx/loader/content/AsyncTaskLoader#getExecutor()()`

Returns the `https://developer.android.com/reference/java/util/concurrent/Executor.html` to use for this `https://developer.android.com/reference/kotlin/androidx/loader/content/Loader`'s `https://developer.android.com/reference/android/os/AsyncTask.html`s.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/loader/content/AsyncTaskLoader#isLoadInBackgroundCanceled()()`

Returns true if the current invocation of `https://developer.android.com/reference/kotlin/androidx/loader/content/AsyncTaskLoader#loadInBackground()` is being canceled.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/loader/content/AsyncTaskLoader#onCancelLoad()()`

Subclasses must implement this to take care of requests to `https://developer.android.com/reference/kotlin/androidx/loader/content/Loader#cancelLoad()`.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/loader/content/AsyncTaskLoader#onForceLoad()()`

Subclasses must implement this to take care of requests to `https://developer.android.com/reference/kotlin/androidx/loader/content/Loader#forceLoad()`.
`D?` `https://developer.android.com/reference/kotlin/androidx/loader/content/AsyncTaskLoader#onLoadInBackground()()`

Calls `https://developer.android.com/reference/kotlin/androidx/loader/content/AsyncTaskLoader#loadInBackground()`.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/loader/content/AsyncTaskLoader#setUpdateThrottle(long)(delayMS: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)`

Set amount to throttle updates by.
From [androidx.loader.content.Loader](https://developer.android.com/reference/kotlin/androidx/loader/content/Loader) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/loader/content/Loader#abandon()()`

This function will normally be called for you automatically by `https://developer.android.com/reference/kotlin/androidx/loader/app/LoaderManager` when restarting a Loader.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/loader/content/Loader#cancelLoad()()`

Attempt to cancel the current load task.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/loader/content/Loader#commitContentChanged()()`

Commit that you have actually fully processed a content change that was returned by `https://developer.android.com/reference/kotlin/androidx/loader/content/Loader#takeContentChanged()`.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` `https://developer.android.com/reference/kotlin/androidx/loader/content/Loader#dataToString(D)(data: D?)`

For debugging, converts an instance of the Loader's data class to a string that can be printed.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/loader/content/Loader#deliverCancellation()()`

Informs the registered `https://developer.android.com/reference/kotlin/androidx/loader/content/Loader.OnLoadCanceledListener` that the load has been canceled.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/loader/content/Loader#forceLoad()()`

Force an asynchronous load.
`https://developer.android.com/reference/android/content/Context.html` `https://developer.android.com/reference/kotlin/androidx/loader/content/Loader#getContext()()` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/loader/content/Loader#getId()()` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/loader/content/Loader#isAbandoned()()`

Return whether this loader has been abandoned.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/loader/content/Loader#isReset()()`

Return whether this load has been reset.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/loader/content/Loader#isStarted()()`

Return whether this load has been started.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/loader/content/Loader#onAbandon()()`

Subclasses implement this to take care of being abandoned.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/loader/content/Loader#onContentChanged()()`

Called when `https://developer.android.com/reference/kotlin/androidx/loader/content/Loader.ForceLoadContentObserver` detects a change.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/loader/content/Loader#registerListener(int,androidx.loader.content.Loader.OnLoadCompleteListener<D>)(id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, listener: https://developer.android.com/reference/kotlin/androidx/loader/content/Loader.OnLoadCompleteListener<D!>)`

Registers a class that will receive callbacks when a load is complete.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/loader/content/Loader#registerOnLoadCanceledListener(androidx.loader.content.Loader.OnLoadCanceledListener<D>)(
listener: https://developer.android.com/reference/kotlin/androidx/loader/content/Loader.OnLoadCanceledListener<D!>
)`

Registers a listener that will receive callbacks when a load is canceled.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/loader/content/Loader#reset()()`

This function will normally be called for you automatically by `https://developer.android.com/reference/kotlin/androidx/loader/app/LoaderManager` when destroying a Loader.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/loader/content/Loader#rollbackContentChanged()()`

Report that you have abandoned the processing of a content change that was returned by `https://developer.android.com/reference/kotlin/androidx/loader/content/Loader#takeContentChanged()` and would like to rollback to the state where there is again a pending content change.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/loader/content/Loader#startLoading()()`

This function will normally be called for you automatically by `https://developer.android.com/reference/kotlin/androidx/loader/app/LoaderManager` when the associated fragment/activity is being started.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/loader/content/Loader#stopLoading()()`

This function will normally be called for you automatically by `https://developer.android.com/reference/kotlin/androidx/loader/app/LoaderManager` when the associated fragment/activity is being stopped.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/loader/content/Loader#takeContentChanged()()`

Take the current flag indicating whether the loader's content had changed while it was stopped.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` `https://developer.android.com/reference/kotlin/androidx/loader/content/Loader#toString()()` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/loader/content/Loader#unregisterListener(androidx.loader.content.Loader.OnLoadCompleteListener<D>)(listener: https://developer.android.com/reference/kotlin/androidx/loader/content/Loader.OnLoadCompleteListener<D!>)`

Remove a listener that was previously added with `https://developer.android.com/reference/kotlin/androidx/loader/content/Loader#registerListener(int,androidx.loader.content.Loader.OnLoadCompleteListener<D>)`.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `@https://developer.android.com/reference/kotlin/androidx/annotation/MainThread
https://developer.android.com/reference/kotlin/androidx/loader/content/Loader#unregisterOnLoadCanceledListener(androidx.loader.content.Loader.OnLoadCanceledListener<D>)(
listener: https://developer.android.com/reference/kotlin/androidx/loader/content/Loader.OnLoadCanceledListener<D!>
)`

Unregisters a listener that was previously added with `https://developer.android.com/reference/kotlin/androidx/loader/content/Loader#registerOnLoadCanceledListener(androidx.loader.content.Loader.OnLoadCanceledListener<D>)`.

## Public constructors

### CursorLoader

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/loader#1.0.0)

```
CursorLoader(context: Context)
```

Creates an empty unspecified CursorLoader. You must follow this with calls to `https://developer.android.com/reference/kotlin/androidx/loader/content/CursorLoader#setUri(android.net.Uri)`, `https://developer.android.com/reference/kotlin/androidx/loader/content/CursorLoader#setSelection(java.lang.String)`, etc to specify the query to perform.

### CursorLoader

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/loader#1.0.0)

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

Creates a fully-specified CursorLoader. See `https://developer.android.com/reference/android/content/ContentResolver.html#query(android.net.Uri, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String)` for documentation on the meaning of the parameters. These will be passed as-is to that call.

## Public functions

### cancelLoadInBackground

```
fun cancelLoadInBackground(): Unit
```

Called on the main thread to abort a load in progress. Override this method to abort the current invocation of `https://developer.android.com/reference/kotlin/androidx/loader/content/AsyncTaskLoader#loadInBackground()` that is running in the background on a worker thread. This method should do nothing if `https://developer.android.com/reference/kotlin/androidx/loader/content/AsyncTaskLoader#loadInBackground()` has not started running or if it has already finished.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/loader/content/AsyncTaskLoader#loadInBackground()` |   |

### deliverResult

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/loader#1.0.0)

```
fun deliverResult(data: Cursor?): Unit
```

Sends the result of the load to the registered listener. Should only be called by subclasses. Must be called from the process's main thread.

| Parameters |
|---|---|
| `data: https://developer.android.com/reference/android/database/Cursor.html?` | the result of the load |

### dump

```
fun [dump](https://developer.android.com/reference/kotlin/androidx/loader/content/CursorLoader#dump(java.lang.String,java.io.FileDescriptor,java.io.PrintWriter,java.lang.String[]))(
    prefix: String,
    fd: FileDescriptor?,
    writer: PrintWriter,
    args: Array<String!>?
): Unit
```

> [!CAUTION]
> **This function is deprecated.**   
>
> Consider using `https://developer.android.com/reference/kotlin/androidx/loader/app/LoaderManager#enableDebugLogging(boolean)` to understand the series of operations performed by LoaderManager.

### getProjection

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/loader#1.0.0)

```
fun getProjection(): Array<String!>?
```

### getSelection

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/loader#1.0.0)

```
fun getSelection(): String?
```

### getSelectionArgs

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/loader#1.0.0)

```
fun getSelectionArgs(): Array<String!>?
```

### getSortOrder

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/loader#1.0.0)

```
fun getSortOrder(): String?
```

### getUri

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/loader#1.0.0)

```
fun getUri(): Uri
```

### loadInBackground

```
fun loadInBackground(): Cursor?
```

Called on a worker thread to perform the actual load and to return the result of the load operation. Implementations should not deliver the result directly, but should return them from this method, which will eventually end up calling `https://developer.android.com/reference/kotlin/androidx/loader/content/Loader#deliverResult(D)` on the UI thread. If implementations need to process the results on the UI thread they may override `https://developer.android.com/reference/kotlin/androidx/loader/content/Loader#deliverResult(D)` and do so there. To support cancellation, this method should periodically check the value of `https://developer.android.com/reference/kotlin/androidx/loader/content/AsyncTaskLoader#isLoadInBackgroundCanceled()` and terminate when it returns true. Subclasses may also override `https://developer.android.com/reference/kotlin/androidx/loader/content/AsyncTaskLoader#cancelLoadInBackground()` to interrupt the load directly instead of polling `https://developer.android.com/reference/kotlin/androidx/loader/content/AsyncTaskLoader#isLoadInBackgroundCanceled()`. When the load is canceled, this method may either return normally or throw `https://developer.android.com/reference/kotlin/androidx/core/os/OperationCanceledException`. In either case, the `https://developer.android.com/reference/kotlin/androidx/loader/content/Loader` will call `https://developer.android.com/reference/kotlin/androidx/loader/content/AsyncTaskLoader#onCanceled(D)` to perform post-cancellation cleanup and to dispose of the result object, if any.

| Returns |
|---|---|
| `https://developer.android.com/reference/android/database/Cursor.html?` | The result of the load operation. |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/os/OperationCanceledException` | if the load is canceled during execution. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/loader/content/AsyncTaskLoader#isLoadInBackgroundCanceled()` |   |
| `https://developer.android.com/reference/kotlin/androidx/loader/content/AsyncTaskLoader#cancelLoadInBackground()` |   |
| `https://developer.android.com/reference/kotlin/androidx/loader/content/AsyncTaskLoader#onCanceled(D)` |   |

### onCanceled

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/loader#1.0.0)

```
fun onCanceled(data: Cursor?): Unit
```

Called if the task was canceled before it was completed. Gives the class a chance to clean up post-cancellation and to properly dispose of the result.

| Parameters |
|---|---|
| `data: https://developer.android.com/reference/android/database/Cursor.html?` | The value that was returned by `https://developer.android.com/reference/kotlin/androidx/loader/content/AsyncTaskLoader#loadInBackground()`, or null if the task threw `https://developer.android.com/reference/kotlin/androidx/core/os/OperationCanceledException`. |

### setProjection

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/loader#1.0.0)

```
fun setProjection(projection: Array<String!>?): Unit
```

### setSelection

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/loader#1.0.0)

```
fun setSelection(selection: String?): Unit
```

### setSelectionArgs

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/loader#1.0.0)

```
fun setSelectionArgs(selectionArgs: Array<String!>?): Unit
```

### setSortOrder

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/loader#1.0.0)

```
fun setSortOrder(sortOrder: String?): Unit
```

### setUri

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/loader#1.0.0)

```
fun setUri(uri: Uri): Unit
```

## Protected functions

### onReset

```
protected fun onReset(): Unit
```

Subclasses must implement this to take care of resetting their loader, as per `https://developer.android.com/reference/kotlin/androidx/loader/content/Loader#reset()`. This is not called by clients directly, but as a result of a call to `https://developer.android.com/reference/kotlin/androidx/loader/content/Loader#reset()`. This will always be called from the process's main thread.

### onStartLoading

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

### onStopLoading

```
protected fun onStopLoading(): Unit
```

Must be called from the UI thread