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
In which folder should I store the images, and how will that matter?
Do I need to have different resolution based images for different type of devices?
Thanks.
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:
Also it would be good to read official documents site about supporting different types of screen.
There are four folder in resource folder 1- drawable-hdpi 2-drawable-ldpi 3-drawable-mdpi 4-drawable-xdpi
To declare different layouts and bitmaps you'd like to use for different screens, you must place these alternative resources in separate directories/folders. This means that if you generate a 200x200 image for xhdpi devices, you should generate the same resource in 150x150 for hdpi, 100x100 for mdpi, and 75x75 for ldpi devices.
Then, place the files in the appropriate drawable resource directory: as per your need
In android we have "Res" folder is nothing but resources folder.Inside this res folder we have other sub folders but for storing images we have four types of folders names are called: drawable-hdpi for High density screens and its resolutions is 480*800
drawable-ldpi for Low density screens and its resolutions is 240*320
drawable-mdpi for Medium density screens and its resolutions is 320*480
drawable-xdpi for Xtra density density screens and its resolutions is 640*960
If you want to match image for multiple screens my suggestion is to use
Nine patch image rather than .png and .bmp for creating nine patch image http://developer.android.com/tools/help/draw9patch.html
See this http://developer.android.com/training/multiscreen/screendensities.html
You can put a particular image in all folders.
It all depends on your os .it ll take by default according to device resolution .
if you want to use same images for all types of screen then you can make an other folder named "drawable" and put all images in that folder. it would work as default drawable.
but if you want to improve image quality on all resolutions. then you need all 4 types images and put then on their respective folder with same image name. you can also make differ XMLs for each resolution.