当前位置: 首页>>代码示例>>Java>>正文


Java ContentProviderClient.query方法代码示例

本文整理汇总了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();
    }
}
 
开发者ID:kranthi0987,项目名称:easyfilemanager,代码行数:25,代码来源:RecentLoader.java

示例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);
    }
}
 
开发者ID:kranthi0987,项目名称:easyfilemanager,代码行数:19,代码来源:DocumentInfo.java

示例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;
}
 
开发者ID:wangyupeng1-iri,项目名称:springreplugin,代码行数:23,代码来源:PluginProviderClient2.java

示例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;
}
 
开发者ID:amikey,项目名称:DroidPlugin,代码行数:15,代码来源:AbstractContentProviderStub.java


注:本文中的android.content.ContentProviderClient.query方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。