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


Java ContentProviderClient.release方法代碼示例

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


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

示例1: installDictToStagingFromContentProvider

import android.content.ContentProviderClient; //導入方法依賴的package包/類
/**
 * Queries a content provider for word list data for some locale and stage the returned files
 *
 * This will query a content provider for word list data for a given locale, and copy the
 * files locally so that they can be mmap'ed. This may overwrite previously cached word lists
 * with newer versions if a newer version is made available by the content provider.
 * @throw FileNotFoundException if the provider returns non-existent data.
 * @throw IOException if the provider-returned data could not be read.
 */
public static void installDictToStagingFromContentProvider(final Locale locale,
        final Context context, final boolean hasDefaultWordList) {
    final ContentProviderClient providerClient;
    try {
        providerClient = context.getContentResolver().
            acquireContentProviderClient(getProviderUriBuilder("").build());
    } catch (final SecurityException e) {
        Log.e(TAG, "No permission to communicate with the dictionary provider", e);
        return;
    }
    if (null == providerClient) {
        Log.e(TAG, "Can't establish communication with the dictionary provider");
        return;
    }
    try {
        final List<WordListInfo> idList = getWordListWordListInfos(locale, context,
                hasDefaultWordList);
        for (WordListInfo id : idList) {
            installWordListToStaging(id.mId, id.mLocale, id.mRawChecksum, providerClient,
                    context);
        }
    } finally {
        providerClient.release();
    }
}
 
開發者ID:sergeychilingaryan,項目名稱:AOSP-Kayboard-7.1.2,代碼行數:35,代碼來源:BinaryDictionaryFileDumper.java

示例2: releaseQuietly

import android.content.ContentProviderClient; //導入方法依賴的package包/類
public static void releaseQuietly(ContentProviderClient client) {
	if (client != null) {
		try {
			client.release();
		} catch (Exception ignored) {
		}
	}
}
 
開發者ID:kranthi0987,項目名稱:easyfilemanager,代碼行數:9,代碼來源:ContentProviderClientCompat.java

示例3: testProvider

import android.content.ContentProviderClient; //導入方法依賴的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

示例4: releaseQuietly

import android.content.ContentProviderClient; //導入方法依賴的package包/類
public static void releaseQuietly(ContentProviderClient client) {
    if (client != null) {
        try {
            if (VERSION.SDK_INT >= Build.VERSION_CODES.N) {
                client.close();
            } else {
                client.release();
            }
        } catch (Exception ignored) {
        }
    }
}
 
開發者ID:7763sea,項目名稱:VirtualHook,代碼行數:13,代碼來源:ContentProviderCompat.java


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