File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Android and the fly likes size of images in different screens Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Android
Bookmark "size of images in different screens" Watch "size of images in different screens" New topic

size of images in different screens

sam liya
Ranch Hand

Joined: Nov 25, 2008
Posts: 1240
I need to handle different screen sizes in android.Anyway i found the below in android developer.

can anyone tell me above details for px values,because when we try to download pictures we found pictures in px values.not in dp .
Steve Luke

Joined: Jan 28, 2003
Posts: 4181

The measurements you gave are for screen density, in 'dots per inch', which is the same as 'pixels per inch' on a screen. There are a wide variety of screen sizes and screen density combinations, so categorizing screens by number of pixels ends up being very difficult. The majority of the reason you care about the number of pixels is based on the density, the number of pixels per inch. You want your assets / images to be clean and take up relatively the same physical size on all devices to make sure they are usable and nice looking.

So to do that, you decide how large, in inches, you want the asset to be. Say you want a particular image to be 1/4" x 1/4" in size. Then you decide how big that image has to be, in pixels, on an mdpi density: at 160dpi, for 1/4", that would be 40 pixels x 40 pixels. Then you convert to the other sizes by multiplying by the correct conversion: lpdi = 3/4 * mdpi (30x30 pixels), hdpi: 1.5 * mdpi (60x60 pixels), and xhdpi = 2 * mdpi (80x80 pixels).

I agree. Here's the link:
subject: size of images in different screens
It's not a secret anymore!