Is there a way to determine android physical screen height in cm or inches?

Use the following: DisplayMetrics dm = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(dm); double x = Math.pow(mWidthPixels/dm.xdpi,2); double y = Math.pow(mHeightPixels/dm.ydpi,2); double screenInches = Math.sqrt(x+y); Log.d(“debug”,”Screen inches : ” + screenInches); When mWidthPixels and mHeightPixels are taken from below code private void setRealDeviceSizeInPixels() { WindowManager windowManager = getWindowManager(); Display display = windowManager.getDefaultDisplay(); DisplayMetrics displayMetrics = new DisplayMetrics(); display.getMetrics(displayMetrics); // … Read more

How can I get screen resolution in java?

You can get the screen size with the Toolkit.getScreenSize() method. Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); double width = screenSize.getWidth(); double height = screenSize.getHeight(); On a multi-monitor configuration you should use this : GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); int width = gd.getDisplayMode().getWidth(); int height = gd.getDisplayMode().getHeight(); If you want to get the screen resolution in DPI you’ll have … Read more

How do I get monitor resolution in Python?

I created a PyPI module for this reason: pip install screeninfo The code: from screeninfo import get_monitors for m in get_monitors(): print(str(m)) Result: monitor(1920×1080+1920+0) monitor(1920×1080+0+0) It supports multi monitor environments. Its goal is to be cross platform; for now it supports Cygwin and X11 but pull requests are totally welcome.