StackTips
 1 minutes

How to Determine Android Screen Size Width and Height

By Editorial @stacktips, On Sep 17, 2023 Android 2.28K Views

The following code snippet shows how to determine the screen size dimensions in width and height of the Android device your application is running on.

Display display = mActivity.getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
int width = size.x;
int height = size.y;

Log.e("Width : " + width);
Log.e("Height : " + height);
stacktips avtar

Editorial

StackTips provides programming tutorials, how-to guides and code snippets on different programming languages.