Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.gawst.asyncdb;
 
 import  android.content.ContentResolver;
 import  android.content.ContentValues;
 import  android.database.Cursor;
 import  android.net.Uri;
 import  android.support.annotation.NonNull;
 import  android.support.annotation.Nullable;
 
Class to mimick exactly the API of Android's AsyncQueryHandler with a org.gawst.asyncdb.AsynchronousDbHelper source

Author(s):
Created by robUx4 on 09/01/2015.
See also:
AsyncDbHelperHandler AsyncDbHelperHandler for a cleaner version
public class AsyncQueryHandler extends AsyncDatabaseHandler<Uri, Uri> {

Constructor similar to Android's AsyncQueryHandler() using a fixed android.net.Uri to access data.

Parameters:
contentResolver
contentProviderUri
	public AsyncQueryHandler(ContentResolver contentResolver, Uri contentProviderUri) {
		this(new ContentProviderDataSource<Uri>(contentResolvercontentProviderUrinew DatabaseElementHandler<Uri>() {
			public String getItemSelectClause(@Nullable Uri itemToSelect) {
				throw new AssertionError("not supported");
			}
			public String[] getItemSelectArgs(@NonNull Uri itemToSelect) {
				throw new AssertionError("not supported");
			}
			@NonNull
			public Uri cursorToItem(@NonNull Cursor cursorthrows InvalidDbEntry {
				throw new AssertionError("not supported");
			}
		}));
	}

Constructor.

Parameters:
dataSource Custom org.gawst.asyncdb.source.ContentProviderDataSource source.
	public AsyncQueryHandler(ContentProviderDataSource<Uri> dataSource) {
		this(new AsynchronousDatabase<Uri, Uri>(dataSourcedataSource.contentProviderUri.getAuthority() + dataSource.contentProviderUri.getPath(), null) {
			protected ContentValues getValuesFromData(Uri databoolean updatethrows RuntimeException {
				throw new AssertionError("not supported");
			}
		}, dataSource);
	}

Constructor.

Parameters:
asynchronousDbHelper The org.gawst.asyncdb.AsynchronousDbHelper database to work with.
dataSource The org.gawst.asyncdb.source.DatabaseSource source used by the asynchronousDbHelper.
	public AsyncQueryHandler(AsynchronousDbHelper<?, Uri> asynchronousDbHelperDatabaseSource<Uri, Uri> dataSource) {
		super(asynchronousDbHelperdataSource);
	}
New to GrepCode? Check out our FAQ X