Get Icon from another android Application
The following snipped should point you in the right direction:
final Intent intent = new Intent(Intent.ACTION_MAIN, null);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
intent.setPackage( packageName );
final List<ResolveInfo> pkgAppsList = pm.queryIntentActivities( intent, 0 );
if( pkgAppsList.size() > 0 ) {
this.url = pkgAppsList.get(0).activityInfo.name;
icon = pkgAppsList.get(0).activityInfo.loadIcon( pm );
this.displayName = pkgAppsList.get(0).activityInfo.loadLabel( pm ).toString();
this.module = pkgAppsList.get(0).activityInfo.packageName;
this.isExternal = true;
this.count = count;
}
I came across this question. Never heard of before. But I guess this should be the solution:
Drawable icon = context.getPackageManager().getApplicationIcon(packageName);
Use PackagerManager's getApplicationIcon() for this task:
Drawable appIcon = getPackageManager().getApplicationIcon("com.google.maps");