http://blog.csdn.net/misly_vinky/article/details/8705022
plintPkgAndCls(getResolveInfos());
private void plintPkgAndCls(List<ResolveInfo> resolveInfos){
for (int i = 0; i < resolveInfos.size(); i++) {
String pkg = resolveInfos.get(i).activityInfo.packageName;
String cls = resolveInfos.get(i).activityInfo.name;
Log.i(TAG, "packageName = " + pkg);
Log.i(TAG, "name = " + cls);
}
}
private List<ResolveInfo> getResolveInfos(){
List<ResolveInfo> appList = null;
Intent intent = new Intent(Intent.ACTION_MAIN, null);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
PackageManager pm = getPackageManager();
appList = pm.queryIntentActivities(intent, 0);
Collections.sort(appList, new ResolveInfo.DisplayNameComparator(pm));
return appList;
}