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