Added in API level 1

AsyncQueryHandler


abstract class AsyncQueryHandler : Handler
kotlin.Any
   ↳ android.os.Handler
   ↳ android.content.AsyncQueryHandler

A helper class to help make handling asynchronous ContentResolver queries easier.

Summary

Nested classes

open

Public constructors

Public methods
Unit

Attempts to cancel operation that has not already started.

open Unit

Unit
startDelete(token: Int, cookie: Any!, uri: Uri!, selection: String!, selectionArgs: Array<String!>!)

This method begins an asynchronous delete.

Unit
startInsert(token: Int, cookie: Any!, uri: Uri!, initialValues: ContentValues!)

This method begins an asynchronous insert.

open Unit
startQuery(token: Int, cookie: Any!, uri: Uri!, projection: Array<String!>!, selection: String!, selectionArgs: Array<String!>!, orderBy: String!)

This method begins an asynchronous query.

Unit
startUpdate(token: Int, cookie: Any!, uri: Uri!, values: ContentValues!, selection: String!, selectionArgs: Array<String!>!)

This method begins an asynchronous update.

Protected methods
open Handler!

open Unit
onDeleteComplete(token: Int, cookie: Any!, result: Int)

Called when an asynchronous delete is completed.

open Unit
onInsertComplete(token: Int, cookie: Any!, uri: Uri!)

Called when an asynchronous insert is completed.

open Unit
onQueryComplete(token: Int, cookie: Any!, cursor: Cursor!)

Called when an asynchronous query is completed.

open Unit
onUpdateComplete(token: Int, cookie: Any!, result: Int)

Called when an asynchronous update is completed.

Inherited functions

Public constructors

AsyncQueryHandler

Added in API level 1
AsyncQueryHandler(cr: ContentResolver!)

Public methods

cancelOperation

Added in API level 1
fun cancelOperation(token: Int): Unit

Attempts to cancel operation that has not already started. Note that there is no guarantee that the operation will be canceled. They still may result in a call to on[Query/Insert/Update/Delete]Complete after this call has completed.

Parameters
token Int: The token representing the operation to be canceled. If multiple operations have the same token they will all be canceled.

handleMessage

Added in API level 1
open fun handleMessage(msg: Message): Unit
Parameters
msg Message: This value cannot be null.

startDelete

Added in API level 1
fun startDelete(
    token: Int,
    cookie: Any!,
    uri: Uri!,
    selection: String!,
    selectionArgs: Array<String!>!
): Unit

This method begins an asynchronous delete. When the delete operation is done onDeleteComplete is called.

Parameters
token Int: A token passed into onDeleteComplete to identify the delete operation.
cookie Any!: An object that gets passed into onDeleteComplete
uri Uri!: the Uri passed to the delete operation.
selection String!: the where clause.

startInsert

Added in API level 1
fun startInsert(
    token: Int,
    cookie: Any!,
    uri: Uri!,
    initialValues: ContentValues!
): Unit

This method begins an asynchronous insert. When the insert operation is done onInsertComplete is called.

Parameters
token Int: A token passed into onInsertComplete to identify the insert operation.
cookie Any!: An object that gets passed into onInsertComplete
uri Uri!: the Uri passed to the insert operation.
initialValues ContentValues!: the ContentValues parameter passed to the insert operation.

startQuery

Added in API level 1
open fun startQuery(
    token: Int,
    cookie: Any!,
    uri: Uri!,
    projection: Array<String!>!,
    selection: String!,
    selectionArgs: Array<String!>!,
    orderBy: String!
): Unit

This method begins an asynchronous query. When the query is done onQueryComplete is called.

Parameters
token Int: A token passed into onQueryComplete to identify the query.
cookie Any!: An object that gets passed into onQueryComplete
uri Uri!: The URI, using the content:// scheme, for the content to retrieve.
projection Array<String!>!: A list of which columns to return. Passing null will return all columns, which is discouraged to prevent reading data from storage that isn't going to be used.
selection String!: A filter declaring which rows to return, formatted as an SQL WHERE clause (excluding the WHERE itself). Passing null will return all rows for the given URI.
selectionArgs Array<String!>!: You may include ?s in selection, which will be replaced by the values from selectionArgs, in the order that they appear in the selection. The values will be bound as Strings.
orderBy String!: How to order the rows, formatted as an SQL ORDER BY clause (excluding the ORDER BY itself). Passing null will use the default sort order, which may be unordered.

startUpdate

Added in API level 1
fun startUpdate(
    token: Int,
    cookie: Any!,
    uri: Uri!,
    values: ContentValues!,
    selection: String!,
    selectionArgs: Array<String!>!
): Unit

This method begins an asynchronous update. When the update operation is done onUpdateComplete is called.

Parameters
token Int: A token passed into onUpdateComplete to identify the update operation.
cookie Any!: An object that gets passed into onUpdateComplete
uri Uri!: the Uri passed to the update operation.
values ContentValues!: the ContentValues parameter passed to the update operation.

Protected methods

createHandler

Added in API level 1
protected open fun createHandler(looper: Looper!): Handler!

onDeleteComplete

Added in API level 1
protected open fun onDeleteComplete(
    token: Int,
    cookie: Any!,
    result: Int
): Unit

Called when an asynchronous delete is completed.

Parameters
token Int: the token to identify the query, passed in from startDelete.
cookie Any!: the cookie object that's passed in from startDelete.
result Int: the result returned from the delete operation

onInsertComplete

Added in API level 1
protected open fun onInsertComplete(
    token: Int,
    cookie: Any!,
    uri: Uri!
): Unit

Called when an asynchronous insert is completed.

Parameters
token Int: the token to identify the query, passed in from startInsert.
cookie Any!: the cookie object that's passed in from startInsert.
uri Uri!: the uri returned from the insert operation.

onQueryComplete

Added in API level 1
protected open fun onQueryComplete(
    token: Int,
    cookie: Any!,
    cursor: Cursor!
): Unit

Called when an asynchronous query is completed.

Parameters
token Int: the token to identify the query, passed in from startQuery.
cookie Any!: the cookie object passed in from startQuery.
cursor Cursor!: The cursor holding the results from the query.

onUpdateComplete

Added in API level 1
protected open fun onUpdateComplete(
    token: Int,
    cookie: Any!,
    result: Int
): Unit

Called when an asynchronous update is completed.

Parameters
token Int: the token to identify the query, passed in from startUpdate.
cookie Any!: the cookie object that's passed in from startUpdate.
result Int: the result returned from the update operation