Where to store images in Android drawables folder?

Rohit picture Rohit · Apr 4, 2013 · Viewed 10.5k times · Source

I am working on Android application that should support 2.1 till latest Android OS (4.2) version. Currently I have few images to display in my image-gallery module. I need to support my app on all devices (smartphone and tablet) which support OS ranging from 2.1 to 4.2 (latest).

Each image is roughly of size 368X387, 50 KB each, PNG type

My workspace res contains following drawable folders:

drawable-hdpi
drawable-ldpi
drawable-mdpi
drawable-xdpi

I have some confusion around

  1. In which folder should I store the images, and how will that matter?

  2. Do I need to have different resolution based images for different type of devices?

Thanks.

Answer

Marko Niciforovic picture Marko Niciforovic · Apr 4, 2013

You can store images only in 1 folder BUT, for example you have device that is mdpi.. it will look good on him, but if you run your app on ldpi android will automatically scale your image and it will look ugly (low quality). So yea you need different resolution based images for different types of devices.. so mdpi resolution images go to drawable-mdpi so hdpi resolution images go to drawable-hdpi etcc..

this is some list i found on internet about screen sizes, maybe you will find it helpful:

Low density Small screens QVGA 240x320 (120dpi):

layout-small-ldpi (240x320)  
layout-small-land-ldpi (320x240)

Low density Normal screens WVGA400 240x400 (x432) (120dpi):

layout-ldpi  (240 x 400 )
layout-land-ldpi  (400 x 240 )

Medium density Normal screens HVGA 320x480 (160dpi):

layout-mdpi (320 x 480 )
layout-land-mdpi (480 x 320 )

Medium density Large screens HVGA 320x480 (160dpi):

layout-large-mdpi (320 x 480 )
layout-large-land-mdpi (480 x 320)

Galaxy Tab ( 240 dpi ):

layout-large  (600 x 1024) 
layout-large-land  (1024 x 600)

High density Normal screens WVGA800 480x800 (x854) (240 dpi):

layout-hdpi (480 x 800)
layout-land-hdpi (800 x 480)

Xoom (medium density large but 1280x800 res) (160 dpi):

layout-xlarge (800 x 1280)
layout-xlarge-land (1280 x 800)

Also it would be good to read official documents site about supporting different types of screen.