Features

How to check the screen resolution on Android

  • Share on Facebook
  • Share on Twitter
  • Share on LinkedIn
  • Share on HackerNews

On Android, you can either check the screen resolution through the device settings or check it programmatically (using Java or Kotlin, or another programming language compatible with Android).

Check Screen Resolution through Settings

The most user-friendly way to check the resolution is by navigating to the Settings app on your Android device.

  1. Open the Settings app on your Android device. The icon looks like a gear or a set of sliders.
  2. Depending on your device, you might find the display settings under Display, Screen or Device settings.
  3. Look for an option that provides information about the screen resolution. It might be labeled as Resolution, Screen resolution or something similar.

Another method is to check the About Phone menu:

  1. Open the Settings app on your Android device. The icon looks like a gear or a set of sliders.
  2. Scroll down to the System section and tap it.
  3. Look for the About phone option and tap it.
  4. Next, scroll down the page and look for an item called Screen Resolution.

Check Screen Resolution with ADB

ADB is an utility that you can use to connect to your Android device, through CLI.

Simply connect your device with a USB cable and make sure that USB debugging is active.

Next, you can use the shell to fetch information about the current window.

adb shell dumpsys window

Look for information in the output that starts with mDisplayInfo, you will see the resolution (width and height) in pixels in the result.

Check Screen Resolution Programmatically

You can use this example code, written in Java, to check the screen resolution of the device.

import android.content.Context;
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.WindowManager;

public class ScreenUtils {

    public static String getScreenResolution(Context context) {
        WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);

        if (windowManager != null) {
            Display display = windowManager.getDefaultDisplay();
            DisplayMetrics metrics = new DisplayMetrics();
            display.getMetrics(metrics);

            int widthPixels = metrics.widthPixels;
            int heightPixels = metrics.heightPixels;

            return widthPixels + " x " + heightPixels;
        } else {
            return "Unknown";
        }
    }
}

Using this class, you can then fetch the resolution anywhere in your Android app:

String resolution = ScreenUtils.getScreenResolution(getApplicationContext());
  • Share on Facebook
  • Share on Twitter
  • Share on LinkedIn
  • Share on HackerNews
TestingBot Logo

Sign up for a Free Trial

Start testing your apps with TestingBot.

No credit card required.

Other Questions