本文整理汇总了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();
}
}
示例2: releaseQuietly
import android.content.ContentProviderClient; //导入方法依赖的package包/类
public static void releaseQuietly(ContentProviderClient client) {
if (client != null) {
try {
client.release();
} catch (Exception ignored) {
}
}
}
示例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"));
}
示例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) {
}
}
}