當前位置: 首頁>>代碼示例>>Java>>正文


Java ContentProviderClient.getType方法代碼示例

本文整理匯總了Java中android.content.ContentProviderClient.getType方法的典型用法代碼示例。如果您正苦於以下問題:Java ContentProviderClient.getType方法的具體用法?Java ContentProviderClient.getType怎麽用?Java ContentProviderClient.getType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.content.ContentProviderClient的用法示例。


在下文中一共展示了ContentProviderClient.getType方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getType

import android.content.ContentProviderClient; //導入方法依賴的package包/類
@Override
public String getType(Uri uri) {
    String targetAuthority = uri.getQueryParameter(Env.EXTRA_TARGET_AUTHORITY);
    if (!TextUtils.isEmpty(targetAuthority) && !TextUtils.equals(targetAuthority, uri.getAuthority())) {
        ContentProviderClient client = getContentProviderClient(targetAuthority);
        try {
            return client.getType(buildNewUri(uri, targetAuthority));
        } catch (RemoteException e) {
            handleExpcetion(e);
        }
    }
    return null;
}
 
開發者ID:amikey,項目名稱:DroidPlugin,代碼行數:14,代碼來源:AbstractContentProviderStub.java

示例2: getContentUriBuilderForType

import android.content.ContentProviderClient; //導入方法依賴的package包/類
/**
 * Gets the content URI builder for a specified type.
 *
 * Supported types include QUERY_PATH_DICT_INFO, which takes the locale as
 * the extraPath argument, and QUERY_PATH_DATAFILE, which needs a wordlist ID
 * as the extraPath argument.
 *
 * @param clientId the clientId to use
 * @param contentProviderClient the instance of content provider client
 * @param queryPathType the path element encoding the type
 * @param extraPath optional extra argument for this type (typically word list id)
 * @return a builder that can build the URI for the best supported protocol version
 * @throws RemoteException if the client can't be contacted
 */
private static Uri.Builder getContentUriBuilderForType(final String clientId,
        final ContentProviderClient contentProviderClient, final String queryPathType,
        final String extraPath) throws RemoteException {
    // Check whether protocol v2 is supported by building a v2 URI and calling getType()
    // on it. If this returns null, v2 is not supported.
    final Uri.Builder uriV2Builder = getProviderUriBuilder(clientId);
    uriV2Builder.appendPath(queryPathType);
    uriV2Builder.appendPath(extraPath);
    uriV2Builder.appendQueryParameter(QUERY_PARAMETER_PROTOCOL,
            QUERY_PARAMETER_PROTOCOL_VALUE);
    if (null != contentProviderClient.getType(uriV2Builder.build())) return uriV2Builder;
    // Protocol v2 is not supported, so create and return the protocol v1 uri.
    return getProviderUriBuilder(extraPath);
}
 
開發者ID:sergeychilingaryan,項目名稱:AOSP-Kayboard-7.1.2,代碼行數:29,代碼來源:BinaryDictionaryFileDumper.java


注:本文中的android.content.ContentProviderClient.getType方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。