所以我这样做是为了得到所有的应用程序:
final Intent mainIntent = new Intent();
final List<ResolveInfo> pkgAppsList = getApplicationContext()
.getPackageManager().queryIntentActivities(mainIntent, 0);
如何按名称获取特定应用程序?
答案 0 :(得分:0)
使用以下代码获取List中设备上安装的所有应用程序名称。您可以按名称查询列表。
PackageManager pm = this.getPackageManager();
Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
List list = pm.queryIntentActivities(mainIntent , PackageManager.PERMISSION_GRANTED);
for (ResolveInfo rInfo : list) {
results.add(rInfo.activityInfo.applicationInfo
.loadLabel(pm).toString());
Log.w("Installed Applications Names", rInfo.activityInfo.applicationInfo
.loadLabel(pm).toString());
}