Question

I have five drawable folders in my android app:

1.drawable-ldpi

2.drawable-mdpi

3.drawable-hdpi

4.drawable-xhdpi

5.drawable-xxhdpi

and I have really large number of images withing my app, I want to know am i have to put all the images in all the folders? or can i abandon some of them? and also if there is a general way to add the images only once to my app.

p.s. my app should run on tablets from 7' to 10' .

Was it helpful?

Solution 2

You need to use just drawable folder if you want to add images only once in your app. You need to add images to this mdpi, xhdpi, etc folders if You want use different images for each device dpi.

OTHER TIPS

Please see this link for how the android system loads resources.

In practice, if you do not want to support multiple screen sizes, you really only need one folder.

drawable

If you want to run your app in different - different devices then yes you have to put your all images in all different folder.

For more reference check out this link http://developer.android.com/guide/practices/screens_support.html

If you will add the HD images in 4.drawable-xhdpi 5.drawable-xxhdpi Folder for Running App only in 7' to 10' TABLET then it will work Fine But you have to convert images in XHDPI & XXHDPI Resolutions as Well. Hope this will help you.

If you don't need to support multiple screens just one folder is enough. otherwise convert your drawable images to each type of pixel density.

You should be careful if you want to remove some of the drawable folder. Low dpi devices could get OutOfMemory exceptions if the try to load big res images. One possible solution is to create several apks for your application where each one points to one or several screen types, in function of their dpi. To do this, you should use the next tags in your manifest. For example, to limit one of your apks to take into account only ldpi and mdpi devices:

<compatible-screens>
    <screen android:screenDensity="ldpi" />
    <screen android:screenDensity="mdpi" />
</compatible-screens>

More info: http://developer.android.com/guide/practices/screens-distribution.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top