Android Screen Size Get getRealScreenDimensions(Context context)

Here you can find the source of getRealScreenDimensions(Context context)

Description

get Real Screen Dimensions

Declaration

public static int[] getRealScreenDimensions(Context context) 

Method Source Code

//package com.java2s;

import android.content.Context;

import android.util.DisplayMetrics;
import android.view.Display;

import android.view.WindowManager;

public class Main {
    public static int[] getRealScreenDimensions(Context context) {

        WindowManager wm = (WindowManager) context
                .getSystemService(Context.WINDOW_SERVICE);
        Display display = wm.getDefaultDisplay();
        DisplayMetrics metrics = new DisplayMetrics();
        display.getRealMetrics(metrics);

        return new int[] { metrics.widthPixels, metrics.heightPixels };

    }//from  w w  w  . ja va 2  s.  c om
}

Related

  1. getScreenPixel(Activity activity)
  2. getScreenWidth(Context context)
  3. getScreenWidth(Context context)
  4. getScreenWidth(Display display)
  5. getScreenSizePixels(Context ctx)
  6. getScreenHeight(Context context)
  7. getScreenSize(@Nonnull Context context)
  8. getScreenWidth(Context context)
  9. getScreenDensity(Context context)