The exact physical pixels per inch of the screen,Get size of pixel,Get DPI,Get count of pixels per inch
float mXDpi;
float mYDpi;
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
mXDpi = metrics.xdpi; // The exact physical pixels per inch of the screen in the X dimension.
mYDpi = metrics.ydpi;
float mMetersToPixelsX = mXDpi / 0.0254f; // 1 inch == 0.0254 metre
float mMetersToPixelsY = mYDpi / 0.0254f;
No comments:
Post a Comment