由于系统应该知道在安装期间评估的适当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...
}
}
}