I'm trying to get the screen's dpi but so far it isn't working. I tried:
DisplayMetrics dm = new DisplayMetrics();
mainContext.getWindowManager().getDefaultDisplay().getMetrics(dm);
SCREEN_DPI = dm.densityDpi;
But both on Samsung Galaxy Tab 10.1 and on Samsung Galaxy S I9000 the SCREEN_DPI is equal to 160. I also tried SCREEN_DPI = dm.density
, but I get the value 1.0
to both cases.
Any help would be greatly appreciated.