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