本文整理汇总了Java中android.content.ContentProviderClient.query方法的典型用法代码示例。如果您正苦于以下问题:Java ContentProviderClient.query方法的具体用法?Java ContentProviderClient.query怎么用?Java ContentProviderClient.query使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.content.ContentProviderClient
的用法示例。
在下文中一共展示了ContentProviderClient.query方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: runInternal
import android.content.ContentProviderClient; //导入方法依赖的package包/类
public void runInternal() {
ContentProviderClient client = null;
try {
client = DocumentsApplication.acquireUnstableProviderOrThrow(
getContext().getContentResolver(), authority);
final Uri uri = DocumentsContract.buildRecentDocumentsUri(authority, rootId);
final Cursor cursor = client.query(
uri, null, null, null, DirectoryLoader.getQuerySortOrder(mSortOrder));
mWithRoot = new RootCursorWrapper(authority, rootId, cursor, MAX_DOCS_FROM_ROOT);
} catch (Exception e) {
Log.w(TAG, "Failed to load " + authority + ", " + rootId, e);
} finally {
ContentProviderClientCompat.releaseQuietly(client);
}
set(mWithRoot);
mFirstPassLatch.countDown();
if (mFirstPassDone) {
onContentChanged();
}
}
示例2: updateFromUri
import android.content.ContentProviderClient; //导入方法依赖的package包/类
public void updateFromUri(ContentResolver resolver, Uri uri) throws FileNotFoundException {
ContentProviderClient client = null;
Cursor cursor = null;
try {
client = DocumentsApplication.acquireUnstableProviderOrThrow(
resolver, uri.getAuthority());
cursor = client.query(uri, null, null, null, null);
if (!cursor.moveToFirst()) {
throw new FileNotFoundException("Missing details for " + uri);
}
updateFromCursor(cursor, uri.getAuthority());
} catch (Throwable t) {
throw asFileNotFoundException(t);
} finally {
IoUtils.closeQuietly(cursor);
ContentProviderClientCompat.releaseQuietly(client);
}
}
示例3: query
import android.content.ContentProviderClient; //导入方法依赖的package包/类
/**
* 调用插件里的Provider
*
* @see android.content.ContentProviderClient#query(Uri, String[], String, String[], String)
*/
public static Cursor query(Context c, Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
ContentProviderClient client = PluginProviderClient.acquireContentProviderClient(c, "");
if (client != null) {
try {
Uri toUri = toCalledUri(c, uri);
return client.query(toUri, projection, selection, selectionArgs, sortOrder);
} catch (RemoteException e) {
if (LogDebug.LOG) {
Log.d(TAG, e.toString());
}
}
}
if (LogDebug.LOG) {
Log.d(TAG, String.format("call query1 %s fail", uri.toString()));
}
return null;
}
示例4: query
import android.content.ContentProviderClient; //导入方法依赖的package包/类
@Override
public Cursor query(Uri uri, String[] projection,
String selection, String[] selectionArgs, String sortOrder) {
String targetAuthority = uri.getQueryParameter(Env.EXTRA_TARGET_AUTHORITY);
if (!TextUtils.isEmpty(targetAuthority) && !TextUtils.equals(targetAuthority, uri.getAuthority())) {
ContentProviderClient client = getContentProviderClient(targetAuthority);
try {
return client.query(buildNewUri(uri, targetAuthority), projection, selection, selectionArgs, sortOrder);
} catch (RemoteException e) {
handleExpcetion(e);
}
}
return null;
}