当前位置: 首页>>代码示例>>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;未经允许,请勿转载。