Code example for AsyncQueryHandler

Methods: startQuery

0
 
	protected void onResume() { 
		super.onResume(); 
		Uri uri = Uri.parse("content://com.android.contacts/data/phones");
		String[] projection = { "_id", "display_name", "data1", "sort_key" };
		asyncQuery.startQuery(0, null, uri, projection, null, null,
				"sort_key COLLATE LOCALIZED asc"); 
	} 
 
	// ²éѯÁªÏµÈË 
	private class MyAsyncQueryHandler extends AsyncQueryHandler {
 
		public MyAsyncQueryHandler(ContentResolver cr) {
			super(cr);
		} 
 
		protected void onQueryComplete(int token, Object cookie, Cursor cursor) {
			if (cursor != null && cursor.getCount() > 0) {
				List<ContentValues> list = new ArrayList<ContentValues>();
				cursor.moveToFirst();
				for (int i = 0; i < cursor.getCount(); i++) {