Hello,
I've been using the DisplayMetrics class to try and have my app figure out the physical size of the display it is running in. This way I can render images of specific sizes in physical dimensions. For example, I'd like to render a circle with diameter 10mm or let's say a diameter of 1inch regardless of the display the app is running in.
heightPixels and widthPixels seem to work in figuring out how many display pixels there are. However, the xdpi and ydpi fields make no sense.
For example, on the Motorola backflip, I see 480x320 for height and width, which matches the physical pixels of the display.
the xdpi field reports 159.3723, and the ydpi field reports 160.41878. Also just as an FYI, the scaled density and scaledDensity are reported as 1.0.
Anyway, if you do the math, it seems like xdpi and ydpi are wrong. For example, with a ruler I measure about 1 and 11/16 inches by 2 and 9/16 inches.
Follow the math.
320*(1 and 11/16 inches) = 189 which is wrong. You can try all combinations to calculate this, and they are all wrong.
What on earth is xdpi and ydpi then?


