Skip to content Skip to sidebar Skip to footer

10 Inch Tablet With 149 Ppi Is Showing As 160 Dpi In Program

Samsung galaxy 10 inch tablet spec is saying that its display density is 149 PPI. But when I printed dpi using display metrics its showing as 160 dpi. how to know the exact dpi o

Solution 1:

PPI and DPI is two different things. The important thing to know about when developing Android applications is the DPI.

It can be found like this:

DisplayMetricsdm=newDisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);
intdpi= dm.densityDpi;

Android works with general classes of DPI:

  • ldpi = 120
  • mdpi = 160
  • hdpi = 240
  • xhdpi = 320

Take a look here for more information: http://developer.android.com/guide/practices/screens_support.html

Solution 2:

Adding to Cant0na answer, which is totally correct, in this great post Dianne Hackborn (Google engineer) explains exactly how the dpi works. I think the reading of it is a must for every Android dev. Among other things, she says:

So Android defines a few major buckets of density values that devices can used, called ldpi (approx 120dpi), mdpi (160 dpi), hdpi (240 dpi), and xhdpi (320 dpi). Manufacturers can select the density that is appropriate for their device, as long as it results in a screen that (after scaling for density) is within the minimum allowed screen size of the platform.

Post a Comment for "10 Inch Tablet With 149 Ppi Is Showing As 160 Dpi In Program"