private Drawable getAppIcon(String packageName) {
List<PackageInfo> packages = getContext().getPackageManager().getInstalledPackages(0);
Drawable appIcon = null;
for (int i = 0; i < packages.size(); i++) {
PackageInfo packageInfo = packages.get(i);
if(packageInfo.packageName.equals(packageName)) {
appIcon = packageInfo.applicationInfo.loadIcon(getContext().getPackageManager());
break;
}
}
return appIcon;
}
List<PackageInfo> packages = getContext().getPackageManager().getInstalledPackages(0);
Drawable appIcon = null;
for (int i = 0; i < packages.size(); i++) {
PackageInfo packageInfo = packages.get(i);
if(packageInfo.packageName.equals(packageName)) {
appIcon = packageInfo.applicationInfo.loadIcon(getContext().getPackageManager());
break;
}
}
return appIcon;
}