I did some google search and look at documentation but i didn't find my answer. Suppose i have an image and two version of it. One for hdpi devices and the other for ldpi devices . Is it important to have two folder with exact name drawable-hdpi and drawable-ldpi ? If yes is this the pattern to use drawable-amountofpixel ? If no how android knows which folder to use when app is running on a hdpi device ?
2 Answers
If App is running on hdpi phone, it will look for the assets and on a same time it will give preference to those icons which are present on drawable-hdpi
or drawable-ldpi
depending on the screen resolution of phone.
For example let us suppose you have image in drawable-ldpi
folder, open your App in hdpi or xhdpi phone. You will find that icon is looking small on those screens but on a same way if you will show drawable-hdpi
icon in ldpi phone you will observe that icon is looking large.
Check this answer to understand more about pixels and how they work on muti screens.

- 10,457
- 4
- 35
- 55
Is it important to have two folder with exact name drawable-hdpi and drawable-ldpi ?
Yes. More accurately, it is important to have two directories that start with drawable
and contain -hdpi
and -ldpi
as appropriate. It is possible to have more complex scenarios (e.g., drawable-sw800-hdpi
).
If yes is this the pattern to use drawable-amountofpixel ?
The pattern is to use the density qualifiers that are covered in the documentation. See:
The "screen density (pixel)" row in the roster of resource set qualifiers

- 986,068
- 189
- 2,389
- 2,491