Get the physical size of the device. Note that it is not the resolution!
The answer http://stackoverflow.com/questions/2193457/is-there-a-way-to-determine-android-physical-screen-height-in-cm-or-inches found from a foreign post
Displaymetrics dm = new displaymetrics (); getwindowmanager (). getdefadisplay display (). getmetrics (DM); Double X = math. pow (DM. widthpixels/DM. xdpi, 2); Double Y = math. pow (DM. heightpixels/DM. ydpi, 2); double screeninches = math. SQRT (x + y); log. D ("debug", "screen inches:" + screeninches );
Another section:
According to the documentation:
the logical density of the display. this is a scaling factor for the density independent pixel unit, where one dip is one pixel on an approximately 160 DPI screen (for example a 240x320, 1.5 "x 2" screen ), providing the baseline of the system's display. thus
On a 160 DPI screen this density value will be 1; on a 120 DPI screen it wocould be. 75; etc.
This value does not exactly follow the real screen size (as given by xdpi and ydpi, but rather is used to scale the size of the overall UI in steps based on gross changes in the display DPI. for example, a 240x320 screen will have a density of 1 even if
its width is 1.8 ", 1.3", etc. however, if the screen resolution is increased to 320x480 but the screen size remained 1.5 "x 2" then the density wocould be increased (probably to 1.5 ).