Get the correct Laucher icon size on Android

I am working on an application that can add shortcut icons to the desktop. What is the correct icon size for Android tablets? (Or is it better to say how to get it at runtime?) It seems to be different from what is written on the this page. I enabled DisplayMetrics.densityDpi and resized the icon accordingly. But this does not work for all devices. It seems that everything is in order, but my Galaxy Tab, when beeing DisplayMetrics.DENSITY_MEDIUM only displays the 48x48px icon (as indicated in the manual), but the usual launch icons - 72x72 pixels, not 48x48 - it differs from the recommendations? Is it possible that this is due to the TouchWiz user interface and therefore different from pure Android? Or where is the problem? It’s also good to notice that the correct launch icon is displayed in the applications themselves (it accepts the icon from the hdpi folder), but during operation it looks like an mdpi device: / Thanks

+2
android icons android-launcher
source share
2 answers

Android tablets look like a single bucket when looking for a launch icon. This means that the mdpi device will actually look in the hdpi folder. This code returns the correct size of startup icons

  ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE); int iconSize = am.getLauncherLargeIconSize(); 

The answer is based on this g + post from Nick Butcher

+6
source share

The best thing is that you use the accessory assembler tool for Android for this task.

it will automatically create the correct sizes and place them in the correct folders.

+1
source share

All Articles