由于系统应该知道在安装期间评估的适当AndroidManifest.xml文件中声明的可用活动:
有没有办法查询这些活动?

最佳答案

当然,看看PackageManager.getInstalledPackages方法。下面是打印已注册活动名称的示例:

List<PackageInfo> pInfos = getPackageManager().getInstalledPackages(PackageManager.GET_ACTIVITIES);
for (PackageInfo pInfo : pInfos) {
  ActivityInfo[] aInfos = pInfo.activities;
  if (aInfos != null) {
    for (ActivityInfo activityInfo : aInfos) {
      Log.i("ACT", activityInfo.name);
      // do whatever else you like...
    }
  }
}

10-08 17:28