Android
android.content
public abstract class

android.content.AsyncQueryHandler

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

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

Nested Classes

Summary

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.
Methods inherited from class android.os.Handler
Methods inherited from class java.lang.Object

Details

Public Constructors

public AsyncQueryHandler(ContentResolver cr)

Public Methods

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 The token representing the operation to be canceled. If multiple operations have the same token they will all be canceled.

public void handleMessage(Message msg)

Subclasses must implement this to receive messages.

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 A token passed into onDeleteComplete(int, Object, int) to identify the delete operation.
cookie An object that gets passed into onDeleteComplete(int, Object, int)
uri the Uri passed to the delete operation.
selection the where clause.

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 A token passed into onInsertComplete(int, Object, Uri) to identify the insert operation.
cookie An object that gets passed into onInsertComplete(int, Object, Uri)
uri the Uri passed to the insert operation.
initialValues the ContentValues parameter passed to the insert operation.

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 A token passed into onQueryComplete(int, Object, Cursor) to identify the query.
cookie An object that gets passed into onQueryComplete(int, Object, Cursor)

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 A token passed into onUpdateComplete(int, Object, int) to identify the update operation.
cookie An object that gets passed into onUpdateComplete(int, Object, int)
uri the Uri passed to the update operation.
values the ContentValues parameter passed to the update operation.

Protected Methods

protected Handler createHandler(Looper looper)

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

Called when an asynchronous delete is completed.

Parameters

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

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

Called when an asynchronous insert is completed.

Parameters

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

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

Called when an asynchronous query is completed.

Parameters

token the token to identify the query, passed in from startQuery(int, Object, Uri, String[], String, String[], String).
cookie the cookie object that's passed in from startQuery(int, Object, Uri, String[], String, String[], String).
cursor The cursor holding the results from the query.

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

Called when an asynchronous update is completed.

Parameters

token the token to identify the query, passed in from startUpdate(int, Object, Uri, ContentValues, String, String[]).
cookie the cookie object that's passed in from startUpdate(int, Object, Uri, ContentValues, String, String[]).
result the result returned from the update operation
Copyright 2007 Google Inc. Build 0.9_r1-98467 - 14 Aug 2008 18:56