當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。