Android获取系统应用信息
我是仿照andorid launcher里面的方法,现抽取如下:
[java]
Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
final PackageManager packageManager = getPackageManager();
List<ResolveInfo> apps = null;
apps = packageManager.queryIntentActivities(mainIntent, 0);
mNameList = new ArrayList<String>();
mDrawableList = new ArrayList<Drawable>();
mNameList.clear();
mDrawableList.clear();
if(apps != null && apps.size() > 0)
{
for (int i = 0; i < apps.size(); i++)
{
mNameList.add((String) apps.get(i).loadLabel(packageManager));//获取应用名称
mDrawableList.add(apps.get(i).loadIcon(packageManager)); //获取应用图片
System.out.println(apps.get(i).loadLabel(packageManager));
}
}
这样就可以过滤出category为Intent.CATEGORY_LAUNCHER的所有的应用了
摘自 知识空间
补充:移动开发 , Android ,