Java tutorial
//package com.java2s; import android.content.Context; import android.content.pm.ApplicationInfo; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.graphics.Bitmap; import android.graphics.drawable.BitmapDrawable; import android.media.ThumbnailUtils; public class Main { public static Bitmap getApkResizedIcon(Context context, String apkPath, int width, int height) { Bitmap thumb = getApkIcon(context, apkPath); if (thumb != null) { return ThumbnailUtils.extractThumbnail(thumb, width, height, ThumbnailUtils.OPTIONS_RECYCLE_INPUT); } return thumb; } public static Bitmap getApkIcon(Context context, String apkPath) { Bitmap thumb = null; PackageManager pm = context.getPackageManager(); PackageInfo info = pm.getPackageArchiveInfo(apkPath, PackageManager.GET_ACTIVITIES); if (info != null) { ApplicationInfo appInfo = info.applicationInfo; appInfo.sourceDir = apkPath; appInfo.publicSourceDir = apkPath; try { thumb = ((BitmapDrawable) appInfo.loadIcon(pm)).getBitmap(); } catch (OutOfMemoryError e) { } } return thumb; } }