1

I did my analysis and found that most of the users of my application will be of samsung galaxy S2, and samsung galaxy note . Doing research on their technical spec, I found: Galaxy S2: 480 x 800 pixels, 4.3' display

Galaxy Note: 1280 x 800, 5.3”screen

How can I categorize these into Layout size and desnity level? I think I can figure out the layout size as mentioned in the android development page However I am unable to know the density level (low, medium high xhigh). They say that I need the dpi but in functional spec, I rarely see the dpi, I just see the above resolution Thank you

Snake
  • 14,228
  • 27
  • 117
  • 250
  • This looks like a duplicate of http://stackoverflow.com/questions/3166501/getting-the-screen-density-programmatically-in-android – Salil Malkan Apr 16 '12 at 18:52
  • It is totally not a duplicate of it. The other guy is talking about reading the matrics from device, I am talking about conversion by pen and paper! – Snake Apr 16 '12 at 20:02

2 Answers2

10

Calculate the density first Density=Square root((wp*wp)+(hp*hp))/di

where wp is width resolution in pixels, hp is height resolution in pixels and di is diagonal size in inches. It would come ~208 for S2.

ldpi ~120dpi,mdpi ~160dpi, hdpi~240dpi, xhdpi ~320dpi. Compare from these values of dpi

Akhil
  • 13,888
  • 7
  • 35
  • 39
0

Not sure if I understand you correctly but you can request the density level and the dpi from the DisplayMetrics class. Using resolution and density you can approximate the display's size.

DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
Niels
  • 313
  • 2
  • 9
  • Thanks but thats not what I was asking for, I was asking about how to convert screen resolution to screen density (dpi) by pen and paper – Snake Apr 16 '12 at 20:05