Dear All,
I use the following codes to get the icon of an apk which is on sdcard
String path = "***/demo.apk"; //the path of the apk
DisplayMetrics metrics = new DisplayMetrics();
PackageParser parser = new PackageParser("");
PackageParser.Package mPackage = parser
                .parsePackage(new File(path), path, metrics, 0);
Resources resource = this.getResources();
AssetManager asset = new AssetManager();
asset.addAssetPath(path);
Resources res = new Resources(asset, resource.getDefaultMetrics(),
resource.getConfiguration());

// get the shortcut icon which is on Launcher after the apk is be
installed
Bitmap bitmap= null;
bitmap= BitmapFactory.decodeResource(res, info.icon);

How can I get the right one according to the phone pixel, since there
is hdpi, mdpi and ldpi, each of them have
the corresponding shortcut icon, and I find I will get the icon from
hdpi, but mdpi is the one I really want.

Thanks for your reading and any advice is welcomed.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to