本文整理汇总了Java中org.robolectric.AndroidManifest.getPackageName方法的典型用法代码示例。如果您正苦于以下问题:Java AndroidManifest.getPackageName方法的具体用法?Java AndroidManifest.getPackageName怎么用?Java AndroidManifest.getPackageName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.robolectric.AndroidManifest
的用法示例。
在下文中一共展示了AndroidManifest.getPackageName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addManifest
import org.robolectric.AndroidManifest; //导入方法依赖的package包/类
public void addManifest(AndroidManifest androidManifest, ResourceLoader loader) {
androidManifests.put(androidManifest.getPackageName(), androidManifest);
ResourceIndex resourceIndex = loader.getResourceIndex();
// first opportunity to access a resource index for this manifest, use it to init the references
androidManifest.initMetaData(loader);
PackageInfo packageInfo = new PackageInfo();
packageInfo.packageName = androidManifest.getPackageName();
packageInfo.versionName = androidManifest.getVersionName();
packageInfo.versionCode = androidManifest.getVersionCode();
ApplicationInfo applicationInfo = new ApplicationInfo();
applicationInfo.flags = androidManifest.getApplicationFlags();
applicationInfo.targetSdkVersion = androidManifest.getTargetSdkVersion();
applicationInfo.packageName = androidManifest.getPackageName();
applicationInfo.processName = androidManifest.getProcessName();
applicationInfo.name = androidManifest.getApplicationName();
applicationInfo.metaData = metaDataToBundle(androidManifest.getApplicationMetaData());
if (androidManifest.getLabelRef() != null && resourceIndex != null) {
Integer id = ResName.getResourceId(resourceIndex, androidManifest.getLabelRef(), androidManifest.getPackageName());
applicationInfo.labelRes = id != null ? id : 0;
}
packageInfo.applicationInfo = applicationInfo;
initApplicationInfo(applicationInfo);
addPackage(packageInfo);
}
示例2: createAppResourceLoader
import org.robolectric.AndroidManifest; //导入方法依赖的package包/类
@Override
protected ResourceLoader createAppResourceLoader(ResourceLoader systemResourceLoader, AndroidManifest appManifest) {
List<PackageResourceLoader> appAndLibraryResourceLoaders = new ArrayList<PackageResourceLoader>();
for (ResourcePath resourcePath : appManifest.getIncludedResourcePaths()) {
appAndLibraryResourceLoaders.add(createResourceLoader(resourcePath));
}
OverlayResourceLoader overlayResourceLoader =
new OverlayResourceLoaderWithDummyResources(
appManifest.getPackageName(), appAndLibraryResourceLoaders, systemResourceLoader);
Map<String, ResourceLoader> resourceLoaders = new HashMap<String, ResourceLoader>();
resourceLoaders.put("android", systemResourceLoader);
resourceLoaders.put(appManifest.getPackageName(), overlayResourceLoader);
return new RoutingResourceLoader(resourceLoaders);
}