This code
final ApplicationInfo ai = getPackageManager().getApplicationInfo("com.company.hello", 0);
final Drawable d = getPackageManager().getApplicationIcon(ai);
retreive a 48x48 (mdpi) drawable even on my hidensity HoneyComb device.
Given that I can enlarge the drawable by Bitmap.createScaledBitmap, I'm asking how to extract the hi density icon that is already there. The method getDrawableForDensity is not available for sdk < 15, but I'm not happy to invoke a scaling function for each icon I've to draw when it is available in the package for free.
Edit for bounty
forgetting for a while my device display density the question is the following: given a own package for which we know for sure to have a 72x72 icon in the relative hdpi res folder, how to extract this icon from another package?
THIS FUNCTION is not available on Honeycomb environment.
to find your drawable directlyy with the good density, you have just to try this :
mContext.getResources().getDrawable(R.drawable.mydrawable);
what is the problem? If android get you a 48x48 icon, it's that the good icon or, you haven't set icon in the good res/drawable- folder.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With