Code example for ActivityInfo

0
  @Override public ActivityInfo getActivityInfo(ComponentName className, int flags) throws NameNotFoundException {
    String packageName = className.getPackageName();
    AndroidManifest androidManifest = androidManifests.get(packageName);
    String activityName = className.getClassName();
    ActivityData activityData = androidManifest.getActivityData(activityName);
    ActivityInfo activityInfo = new ActivityInfo();
    activityInfo.packageName = packageName;
    activityInfo.name = activityName;
    if (activityData != null) {
      ResourceIndex resourceIndex = Robolectric.getShadowApplication().getResourceLoader().getResourceIndex();
      activityInfo.theme = resourceIndex.getResourceId(new ResName(activityData.getThemeRef()));
    } 
    activityInfo.applicationInfo = getApplicationInfo(packageName, flags);
    return activityInfo;
  } 
 
  @Override 
  public List<PackageInfo> getInstalledPackages(int flags) {
    return new ArrayList<PackageInfo>(packageInfos.values());
  }