3

I have an Android app containing about 150 icons for each screen resolution.

If I put all the icons in all 5 major resolutions (ldpi, mdpi, hdpi, xhdpi, xxhdpi), then it will make the total number of icons to 750. This has several drawbacks:

  • Big APK size
  • Slow build process when using dexguard with ant build script. It does some processing on the images that take some time.

Alternatively I can put icons only in some of the resolutions. For instance ldpi devices are only 10% of the market now, and somewhere in Android official doc they say that Android can efficiently scale down 50% from hdpi icons to ldpi.

Now, if I chose to go this way and not provide ldpi icons, what will be the impact of resizing the icons from hdpi to ldpi at runtime on the Android device? If it needs to resize 150 icons it can take some time, especialy since ldpi devices are likely to have slower CPU. At which stage does the resizing happen on Android devices: at install time? At first app launch time? At each launch?

Thank you for your suggestions!

gpo
  • 3,388
  • 3
  • 31
  • 53
  • is the icon used for listview images or they used for layout images ? – Basbous Oct 08 '13 at 08:52
  • I ask myself the same question for a while. Thanks for asking. I 'll have a look on other's suggestions. Each time my conclusion is regarding the vely low memory footprint of ldpi folder. I finally put it every time. Regarding the slow build process . think abot putting them lately in development process. – HoodVinci Oct 08 '13 at 08:52
  • @Basbous the icons are used in layout images – gpo Oct 09 '13 at 06:43

3 Answers3

0

When you decompile Google's own APKs they are not using ldpi at all for a time. And they are using xxhdpi only for launcher icon of the applications. xxhdpi icons especially makes the APK sizes bigger.

The resizing of the icons probably done on runtime at each launch.

tasomaniac
  • 10,234
  • 6
  • 52
  • 84
  • Thanks for the info about Google's APK. I guess I'll end up doing the same. – gpo Oct 09 '13 at 06:42
  • I have just decompiled the latest Google Maps APK and there is no xxhdpi at all. And there is only one png image in ldpi folder which is probably not used at all. – tasomaniac Oct 09 '13 at 11:25
  • 1
    Even Roman Nurik says don't worry about ldpi here http://www.youtube.com/watch?v=zhszwkcay2A – tasomaniac Oct 11 '13 at 06:24
0

If the images are used at the layout you can use the xxhdpi images and then you can generate the xhdpi, hdpi, mdpi and ldpi at run time.

  1. Get the Image from the xxhdpi.
  2. scale it to the needed resolution.
  3. use it in your layout.
  4. write it in the disk.

try this to generate thumb at runtime.

Community
  • 1
  • 1
Basbous
  • 3,927
  • 4
  • 34
  • 62
0

Android will nicely* scale down your drawables by a difference of up to 2 density buckets. It looks like crap if you try to do more than 2 buckets (ie. more than a factor of 2). So you should provide every third bucket - currently xxxhdpi and hdpi only.

*Unless you have pixel art in your drawables (but don't do that), where bilinear interpolation won't be acceptable. Then you should pick a minimum supported bucket and provide everything above that.

Karu
  • 4,512
  • 4
  • 30
  • 31