【发布时间】:2015-03-30 23:08:48
【问题描述】:
我对如何从以下链接获取所有已安装应用程序的信息进行了一些研究。 How to get a list of all installed apps on a android device
链接给出的代码如下:
final Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
final List pkgAppsList = context.getPackageManager().queryIntentActivities( mainIntent, 0);
我做了一些研究,但找不到以下两个问题的答案。
有没有办法获取应用程序的名称而不是包名称?
我可以将其存储在字符串数组中 (
String[] nameofappsinstalled) 吗?
我的目标是制作一个简单的应用程序,其中安装了所有应用程序的名称并将它们放在一个列表视图中。列表视图接受 String[](字符串数组),应用程序在 List 类中返回。
【问题讨论】:
-
首先,创建你的字符串数组。然后遍历作为粘贴代码的结果获得的列表 - 单独检索每个应用程序信息,并将名称放入您的数组中。有什么困难?
标签: android arrays android-listview