本文整理汇总了Java中android.content.ContentResolver.acquireContentProviderClient方法的典型用法代码示例。如果您正苦于以下问题:Java ContentResolver.acquireContentProviderClient方法的具体用法?Java ContentResolver.acquireContentProviderClient怎么用?Java ContentResolver.acquireContentProviderClient使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.content.ContentResolver
的用法示例。
在下文中一共展示了ContentResolver.acquireContentProviderClient方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: acquireUnstableContentProviderClient
import android.content.ContentResolver; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public static ContentProviderClient acquireUnstableContentProviderClient(ContentResolver resolver, String authority){
if(Utils.hasJellyBeanMR1()){
return resolver.acquireUnstableContentProviderClient(authority);
}
else{
return resolver.acquireContentProviderClient(authority);
}
}
示例2: testProvider
import android.content.ContentResolver; //导入方法依赖的package包/类
@Test public void testProvider() {
final ContentResolver resolver = context().getContentResolver();
// Regular provider access
final String android_id = Settings.System.getString(resolver, Settings.System.ANDROID_ID);
assertNotNull(android_id);
final ContentProviderClient client = resolver.acquireContentProviderClient(Settings.AUTHORITY);
assertNotNull(client);
client.release();
sCondomProcessPackageManager.mCondom.mOutboundJudge = mBlockAllJudge;
assertNull(resolver.acquireContentProviderClient("downloads"));
}
示例3: getProvider
import android.content.ContentResolver; //导入方法依赖的package包/类
private static ContentProviderClient getProvider(Context context) {
if (sProvider != null) {
return sProvider;
}
synchronized (LOCK) {
if (sProvider != null) {
return sProvider;
}
ContentResolver cr = context.getContentResolver();
if (cr == null) {
// 不太可能,但保险起见还是返回
if (LogRelease.LOGR) {
LogRelease.e(LogDebug.PLUGIN_TAG, "pipp.gp: cr n");
}
return null;
}
ContentProviderClient cpc = cr.acquireContentProviderClient(PluginFastInstallProvider.CONTENT_URI);
if (cpc == null) {
// 获取Provider失败,可能性不大,先返回空
if (LogRelease.LOGR) {
LogRelease.e(LogDebug.PLUGIN_TAG, "pipp.gp: cpc n");
}
return null;
}
// 缓存下来,以备后用
sProvider = cpc;
return cpc;
}
}