Can someone tell me how Android calculates screen density?
My problem is that I have a device (ODYS Space) with a resolution of 480x800 and with a 7-inch diagonal screen. If I calculated its density, I get a value of 133 DPI, but Android (2.2 and 2.3 too) reports this as a MEDIUM density device (160 DPI).
I am struggling with multi-screen support, so I assumed that 133 DPI would be reported as “LOW” than “MEDIUM”, so now my screen layout looks pretty dumb on this device with a message with a message.
I test the device with the code as follows:
DisplayMetrics dMetrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(dMetrics); int d=dMetrics.densityDpi;
If I ran this code on a configured virtual device (480x800 / 7 "and 133 DPI), then I got density = 120.
On a real device, why does he say 160 instead?
source share