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