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


Java ContentProvider.attachInfo方法代碼示例

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


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

示例1: installProvider

import android.content.ContentProvider; //導入方法依賴的package包/類
private ContentProvider installProvider(PluginInfo pluginInfo, ProviderInfo providerInfo) {
    try {
        Logger.d(TAG, "installProvider() providerInfo = " + providerInfo);
        Class clazz = pluginInfo.classLoader.loadClass(providerInfo.name);
        ContentProvider contentProvider = (ContentProvider) clazz.newInstance();
        contentProvider.attachInfo(pluginInfo.baseContext, providerInfo);

        synchronized (mContentProviderMap) {
            ContentProvider cp = mContentProviderMap.get(providerInfo.name);
            if (cp != null) {
                Logger.d(TAG, "installProvider() lose race!");
                contentProvider = cp;
            } else {
                mContentProviderMap.put(providerInfo.name, contentProvider);
                PluginManager.getInstance(getContext()).callProviderOnCreate(contentProvider, mStubInfo, providerInfo);
            }
        }

        Logger.d(TAG, "installProvider() providerInfo -> " + contentProvider);
        return contentProvider;
    } catch (Exception e) {
        Logger.e(TAG, "installProvider() error! providerInfo = " + providerInfo, e);
    }

    return null;
}
 
開發者ID:xyxyLiu,項目名稱:PluginM,代碼行數:27,代碼來源:PluginStubMainProvider.java

示例2: setUpContentProvider

import android.content.ContentProvider; //導入方法依賴的package包/類
private void setUpContentProvider(ContentProvider targetProvider) throws Exception {
    mResolver = new ChangeRecordingMockContentResolver();

    final String filenamePrefix = this.getClass().getSimpleName() + ".";
    RenamingDelegatingContext targetContextWrapper =
            new RenamingDelegatingContext(
                new ContentProviderMockContext(),
                (Context)getActivity(),
                filenamePrefix);

    mProviderContext = new IsolatedContext(mResolver, targetContextWrapper);

    targetProvider.attachInfo(mProviderContext, null);

    mProvider = new DelegatingTestContentProvider(targetProvider);
    mProvider.attachInfo(mProviderContext, null);

    mResolver.addProvider(mProviderAuthority, mProvider);
}
 
開發者ID:jrconlin,項目名稱:mc_backup,代碼行數:20,代碼來源:ContentProviderTest.java

示例3: prepareProvider

import android.content.ContentProvider; //導入方法依賴的package包/類
private ContentProvider prepareProvider(ContentProvider provider) {
    provider.attachInfo(this, null);
    provider.onCreate();
    return provider;
}
 
開發者ID:CmDnoEdition,項目名稱:fdroid,代碼行數:6,代碼來源:MultiRepoUpdaterTest.java


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