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


Java ContentResolver.acquireContentProviderClient方法代碼示例

本文整理匯總了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);
	}
}
 
開發者ID:kranthi0987,項目名稱:easyfilemanager,代碼行數:10,代碼來源:ContentProviderClientCompat.java

示例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"));
}
 
開發者ID:Trumeet,項目名稱:MiPushFramework,代碼行數:14,代碼來源:CondomProcessTest.java

示例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;
    }
}
 
開發者ID:wangyupeng1-iri,項目名稱:springreplugin,代碼行數:33,代碼來源:PluginFastInstallProviderProxy.java


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