本文整理匯總了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;
}
}