1

I am using DisplayMetrics to get device density but it is not returning the exact value for device density i.e if density is 149 it returns 160. I need this density to find my device actual size in inches. My straight question is to find the exact value i.e 149 not 160.

Please help me out.

Thanks

varun bhardwaj
  • 1,522
  • 13
  • 24
  • Duplication: http://stackoverflow.com/questions/2193457/is-there-a-way-to-determine-android-physical-screen-height-in-cm-or-inches I think its 100% right. – hasan Sep 23 '13 at 14:35
  • Actually I used this solution for me but it didn't work well on some devices as explained by me. So its not duplicate :) – varun bhardwaj Sep 23 '13 at 14:50
  • It's still a duplicate _question_ if the answer isn't complete. – Ben S Sep 23 '13 at 21:34

1 Answers1

0

From inside an activity:

float density = this.getResources().getDisplayMetrics().density;
hasan
  • 23,815
  • 10
  • 63
  • 101