2

I have a method that returns device width size in IN/MM.

private double checkDeviceSizeInInches(){
    DisplayMetrics dm = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(dm);
    double xSize = Math.pow(dm.widthPixels/dm.xdpi,2);
    double y = Math.pow(dm.heightPixels/dm.ydpi,2);

    return Math.sqrt(xSize);
}

On all of the devices that i was testing it was ok, except on Samsung Galaxy Stratosphere 2. You can see on the image below that this method returns 76mm for the width(that is not correct).

What do you think, is there any problem with the device or ?

Device spec link : http://www.samsung.com/us/mobile/cell-phones/SCH-I415SAAVZW Samsung Galaxy Stratosphere 2

nikolaDev
  • 1,802
  • 2
  • 14
  • 15
  • Probably the problem is the same as in your previous case [Setting fixed width size of view with pt/mm/in ANDROID](http://stackoverflow.com/questions/27339222/setting-fixed-width-size-of-view-with-pt-mm-in-android/27339322#27339322). Particular device give improper information about it's dpi and so calculations are improper... – michal.z Dec 07 '14 at 13:12

0 Answers0