List of utility methods to do APK Icon Get
Drawable | getAppIcon(Context c, int uid) get App Icon PackageManager pm = c.getPackageManager(); Drawable icon = null; try { String name = pm.getPackagesForUid(uid)[0]; icon = (Drawable) getAppInfo(c, name).loadIcon(pm); } catch (NameNotFoundException e) { e.printStackTrace(); } catch (NullPointerException e) { ... |
Drawable | getAppIcon(Context c, int uid) get App Icon PackageManager pm = c.getPackageManager(); Drawable icon = null; try { String name = pm.getPackagesForUid(uid)[0]; icon = (Drawable) getAppInfo(c, name).loadIcon(pm); } catch (NameNotFoundException e) { e.printStackTrace(); } catch (NullPointerException e) { ... |
int | getDensityOptimizedIconSize(final Context context) get Density Optimized Icon Size int iconSize; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) { iconSize = ((ActivityManager) context .getSystemService(Context.ACTIVITY_SERVICE)) .getLauncherLargeIconSize(); } else { iconSize = (int) context.getResources().getDimension( android.R.dimen.app_icon_size); ... |
Drawable | getDensityOptimizedIconSizeDrawable( final Context myAppContext, final Context targetPackageContext, final int resId) get Density Optimized Icon Size Drawable int adjustedResId = resId; if (adjustedResId <= 0) { adjustedResId = android.R.drawable.sym_def_app_icon; int density; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { density = ((ActivityManager) myAppContext .getSystemService(Context.ACTIVITY_SERVICE)) ... |
Drawable | showUninstallAPKIcon(Context c, String apkPath) show Uninstall APK Icon String PATH_PackageParser = "android.content.pm.PackageParser"; String PATH_AssetManager = "android.content.res.AssetManager"; try { Class<?> pkgParserCls = Class.forName(PATH_PackageParser); Class[] typeArgs = new Class[1]; typeArgs[0] = String.class; Constructor<?> pkgParserCt = pkgParserCls .getConstructor(typeArgs); ... |