# Print output for @column tags ?>
Developers

- Design
- Develop
- Distribute

Developer Console

## Most visited

## Recently visited

## Results for

Summary: Nested Classes | Ctors | Methods | Protected Methods | Inherited Methods

# AsyncQueryHandler

`public abstract class AsyncQueryHandler`
`` `extends Handler` ``

java.lang.Object
↳ | android.os.Handler
| ↳ | android.content.AsyncQueryHandler

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

## Summary

### Nested classes
`class` | `AsyncQueryHandler.WorkerArgs`
`class` | `AsyncQueryHandler.WorkerHandler`

### Public constructors
`AsyncQueryHandler(ContentResolver cr)`

### Public methods
`final void` | `cancelOperation(int token)` Attempts to cancel operation that has not already started.
`void` | `handleMessage(Message msg)` Subclasses must implement this to receive messages.
`final void` | `startDelete(int token, Object cookie, Uri uri, String selection, String[] selectionArgs)` This method begins an asynchronous delete.
`final void` | `startInsert(int token, Object cookie, Uri uri, ContentValues initialValues)` This method begins an asynchronous insert.
`void` | `startQuery(int token, Object cookie, Uri uri, String[] projection, String selection, String[] selectionArgs, String orderBy)` This method begins an asynchronous query.
`final void` | `startUpdate(int token, Object cookie, Uri uri, ContentValues values, String selection, String[] selectionArgs)` This method begins an asynchronous update.

### Protected methods
`Handler` | `createHandler(Looper looper)`
`void` | `onDeleteComplete(int token, Object cookie, int result)` Called when an asynchronous delete is completed.
`void` | `onInsertComplete(int token, Object cookie, Uri uri)` Called when an asynchronous insert is completed.
`void` | `onQueryComplete(int token, Object cookie, Cursor cursor)` Called when an asynchronous query is completed.
`void` | `onUpdateComplete(int token, Object cookie, int result)` Called when an asynchronous update is completed.

### Inherited methods
From class `android.os.Handler`
`static Handler` | `createAsync(Looper looper, Handler.Callback callback)` Create a new Handler whose posted messages and runnables are not subject to synchronization barriers such as display vsync.
`static Handler` | `createAsync(Looper looper)` Create a new Handler whose posted messages and runnables are not subject to synchronization barriers such as display vsync.
`void` | `dispatchMessage(Message msg)` Handle system messages here.
`final void` | `dump(Printer pw, String prefix)`
`final Looper` | `getLooper()`
`String` | `getMessageName(Message message)` Returns a string representing the name of the specified message.
`void` | `handleMessage(Message msg)` Subclasses must implement this to receive messages.
`final boolean` | `hasCallbacks(Runnable r)` Check if there are any pending posts of messages with callback r in the message queue.
`final boolean` | `hasMessages(int what)` Check if there are any pending posts of messages with code 'what' in the message queue.
`final boolean` | `hasMessages(int what, Object object)` Check if there are any pending posts of messages with code 'what' and whose obj is 'object' in the message queue.
`final Message` | `obtainMessage(int what, Object obj)` Same as `obtainMessage()`, except that it also sets the what and obj members of the returned Message.
`final Message` | `obtainMessage()` Returns a new `Message` from the global message pool.
`final Message` | `obtainMessage(int what, int arg1, int arg2)` Same as `obtainMessage()`, except that it also sets the what, arg1 and arg2 members of the returned Message.
`final Message` | `obtainMessage(int what, int arg1, int arg2, Object obj)` Same as `obtainMessage()`, except that it also sets the what, obj, arg1,and arg2 values on the returned Message.
`final Message` | `obtainMessage(int what)` Same as `obtainMessage()`, except that it also sets the what member of the returned Message.
`final boolean` | `post(Runnable r)` Causes the Runnable r to be added to the message queue.
`final boolean` | `postAtFrontOfQueue(Runnable r)` Posts a message to an object that implements Runnable.
`final boolean` | `postAtTime(Runnable r, long uptimeMillis)` Causes the Runnable r to be added to the message queue, to be run at a specific time given by uptimeMillis.
`final boolean` | `postAtTime(Runnable r, Object token, long uptimeMillis)` Causes the Runnable r to be added to the message queue, to be run at a specific time given by uptimeMillis.
`final boolean` | `postDelayed(Runnable r, long delayMillis)` Causes the Runnable r to be added to the message queue, to be run after the specified amount of time elapses.
`final boolean` | `postDelayed(Runnable r, Object token, long delayMillis)` Causes the Runnable r to be added to the message queue, to be run after the specified amount of time elapses.
`final void` | `removeCallbacks(Runnable r)` Remove any pending posts of Runnable r that are in the message queue.
`final void` | `removeCallbacks(Runnable r, Object token)` Remove any pending posts of Runnable r with Object token that are in the message queue.
`final void` | `removeCallbacksAndMessages(Object token)` Remove any pending posts of callbacks and sent messages whose obj is token.
`final void` | `removeMessages(int what)` Remove any pending posts of messages with code 'what' that are in the message queue.
`final void` | `removeMessages(int what, Object object)` Remove any pending posts of messages with code 'what' and whose obj is 'object' that are in the message queue.
`final boolean` | `sendEmptyMessage(int what)` Sends a Message containing only the what value.
`final boolean` | `sendEmptyMessageAtTime(int what, long uptimeMillis)` Sends a Message containing only the what value, to be delivered at a specific time.
`final boolean` | `sendEmptyMessageDelayed(int what, long delayMillis)` Sends a Message containing only the what value, to be delivered after the specified amount of time elapses.
`final boolean` | `sendMessage(Message msg)` Pushes a message onto the end of the message queue after all pending messages before the current time.
`final boolean` | `sendMessageAtFrontOfQueue(Message msg)` Enqueue a message at the front of the message queue, to be processed on the next iteration of the message loop.
`boolean` | `sendMessageAtTime(Message msg, long uptimeMillis)` Enqueue a message into the message queue after all pending messages before the absolute time (in milliseconds) uptimeMillis.
`final boolean` | `sendMessageDelayed(Message msg, long delayMillis)` Enqueue a message into the message queue after all pending messages before (current time + delayMillis).
`String` | `toString()` Returns a string representation of the object.
From class `java.lang.Object`
`Object` | `clone()` Creates and returns a copy of this object.
`boolean` | `equals(Object obj)` Indicates whether some other object is "equal to" this one.
`void` | `finalize()` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
`final Class<?>` | `getClass()` Returns the runtime class of this `Object`.
`int` | `hashCode()` Returns a hash code value for the object.
`final void` | `notify()` Wakes up a single thread that is waiting on this object's monitor.
`final void` | `notifyAll()` Wakes up all threads that are waiting on this object's monitor.
`String` | `toString()` Returns a string representation of the object.
`final void` | `wait(long timeout, int nanos)` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
`final void` | `wait(long timeout)` Causes the current thread to wait until either another thread invokes the `notify()` method or the `notifyAll()` method for this object, or a specified amount of time has elapsed.
`final void` | `wait()` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object.

## Public constructors

### AsyncQueryHandler

    public AsyncQueryHandler (ContentResolver cr)

Parameters
`cr` | `ContentResolver`

## Public methods

### cancelOperation

    public final void cancelOperation (int token)

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

    public void handleMessage (Message msg)

Subclasses must implement this to receive messages.

Parameters
`msg` | `Message`: This value cannot be `null`.

### startDelete

    public final void startDelete (int token,
                    Object cookie,
                    Uri uri,
                    String selection,
                    String[] selectionArgs)

This method begins an asynchronous delete. When the delete operation is done `onDeleteComplete(int, Object, int)` is called.

Parameters
`token` | `int`: A token passed into `onDeleteComplete(int, Object, int)` to identify the delete operation.
`cookie` | `Object`: An object that gets passed into `onDeleteComplete(int, Object, int)`
`uri` | `Uri`: the Uri passed to the delete operation.
`selection` | `String`: the where clause.
`selectionArgs` | `String`

### startInsert

    public final void startInsert (int token,
                    Object cookie,
                    Uri uri,
                    ContentValues initialValues)

This method begins an asynchronous insert. When the insert operation is done `onInsertComplete(int, Object, Uri)` is called.

Parameters
`token` | `int`: A token passed into `onInsertComplete(int, Object, Uri)` to identify the insert operation.
`cookie` | `Object`: An object that gets passed into `onInsertComplete(int, Object, Uri)`
`uri` | `Uri`: the Uri passed to the insert operation.
`initialValues` | `ContentValues`: the ContentValues parameter passed to the insert operation.

### startQuery

    public void startQuery (int token,
                    Object cookie,
                    Uri uri,
                    String[] projection,
                    String selection,
                    String[] selectionArgs,
                    String orderBy)

This method begins an asynchronous query. When the query is done `onQueryComplete(int, Object, Cursor)` is called.

Parameters
`token` | `int`: A token passed into `onQueryComplete(int, Object, Cursor)` to identify the query.
`cookie` | `Object`: An object that gets passed into `onQueryComplete(int, Object, Cursor)`
`uri` | `Uri`: The URI, using the content:// scheme, for the content to retrieve.
`projection` | `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` | `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

    public final void startUpdate (int token,
                    Object cookie,
                    Uri uri,
                    ContentValues values,
                    String selection,
                    String[] selectionArgs)

This method begins an asynchronous update. When the update operation is done `onUpdateComplete(int, Object, int)` is called.

Parameters
`token` | `int`: A token passed into `onUpdateComplete(int, Object, int)` to identify the update operation.
`cookie` | `Object`: An object that gets passed into `onUpdateComplete(int, Object, int)`
`uri` | `Uri`: the Uri passed to the update operation.
`values` | `ContentValues`: the ContentValues parameter passed to the update operation.
`selection` | `String`
`selectionArgs` | `String`

## Protected methods

### createHandler

    protected Handler createHandler (Looper looper)

Parameters
`looper` | `Looper`

Returns
`Handler` |

### onDeleteComplete

    protected void onDeleteComplete (int token,
                    Object cookie,
                    int result)

Called when an asynchronous delete is completed.

Parameters
`token` | `int`: the token to identify the query, passed in from `startDelete(int, Object, Uri, String, String[])`.
`cookie` | `Object`: the cookie object that's passed in from `startDelete(int, Object, Uri, String, String[])`.
`result` | `int`: the result returned from the delete operation

### onInsertComplete

    protected void onInsertComplete (int token,
                    Object cookie,
                    Uri uri)

Called when an asynchronous insert is completed.

Parameters
`token` | `int`: the token to identify the query, passed in from `startInsert(int, Object, Uri, ContentValues)`.
`cookie` | `Object`: the cookie object that's passed in from `startInsert(int, Object, Uri, ContentValues)`.
`uri` | `Uri`: the uri returned from the insert operation.

### onQueryComplete

    protected void onQueryComplete (int token,
                    Object cookie,
                    Cursor cursor)

Called when an asynchronous query is completed.

Parameters
`token` | `int`: the token to identify the query, passed in from `startQuery(int, Object, Uri, String[], String, String[], String)`.
`cookie` | `Object`: the cookie object passed in from `startQuery(int, Object, Uri, String[], String, String[], String)`.
`cursor` | `Cursor`: The cursor holding the results from the query.

### onUpdateComplete

    protected void onUpdateComplete (int token,
                    Object cookie,
                    int result)

Called when an asynchronous update is completed.

Parameters
`token` | `int`: the token to identify the query, passed in from `startUpdate(int, Object, Uri, ContentValues, String, String[])`.
`cookie` | `Object`: the cookie object that's passed in from `startUpdate(int, Object, Uri, ContentValues, String, String[])`.
`result` | `int`: the result returned from the update operation

Full name *
Email address *
Company / developer name
One of your Play Store app URLs *
Which best describes your business:*
Apps
Games
Apps & Games
*
*