取系统中的图片
private List<ResolveInfo> loadApps() {
List<ResolveInfo> mApps;
Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
mApps = getPackageManager().queryIntentActivities(mainIntent, 0);
return mApps;
}
使用
List<ResolveInfo> mApp = loadApps() ;
ImageView imageView = new ImageView(context);
ResolveInfo info = mApps.get(position);
imageView.setImageDrawable(info.activityInfo.loadIcon(getPackageManager()));