I have a very simple question.
All I'm looking for is the code to find the PPI of an android screen, i know how to find the height and width in pixels but not the amount of pixels per inch. I need this to help me find the diagonal of the screen. I tried but it doesn't seem to work
DisplayMetrics displayMetrics = new DisplayMetrics();
WindowManager wm = (WindowManager) getApplicationContext().getSystemService(Context.WINDOW_SERVICE);
int ppi = (int) displayMetrics.density;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.