its simple my doubt.
The app have 4 directories(ldpi, mdpi, hdpi, xhdpi) with same images but different dpi . For mdpi is 160dpi, the one im using atm.
What happens with the images i download from the web? i have a news reader and that means each new have one image at least. And i want to have a decent image for all the smartphones.
Do i need different type of images or just download the same for all?
Can i know which resolution is best for each particular smartphone?
I couldn’t find the “official” way to handle this so i dont know if its important dpi for images that we plan to download.
Regards!
ldpi means ~120dpi,mdpi means ~160dpi, hdpi means ~240dpi. xhdpi means ~320dpi.
you can follow 3:4:6:8 ratio for ldpi:mdpi:hdpi:xhdpi for resources.
Now you can have different images for all the resolution it is better and there must be no problem. If you cant have different images for all then have a image for xhdpi and runtime you can resize the image depending on the screen resolution.
YOu can use below sample code to know the screen resolution at runtime::
sample code to resize the bitmap::
now you have the new bitmap new width and height you can use it.