Android Screen Size Get getScreenSize(Context context)

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

Description

get Screen Size

Declaration

public static int[] getScreenSize(Context context) 

Method Source Code

//package com.java2s;

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

public class Main {
    public static int[] getScreenSize(Context context) {
        int[] ints = { 0, 0 };
        DisplayMetrics displayMetrics = new DisplayMetrics();
        WindowManager windowManager = ((WindowManager) context
                .getSystemService(Context.WINDOW_SERVICE));
        windowManager.getDefaultDisplay().getMetrics(displayMetrics);
        ints[0] = displayMetrics.widthPixels;
        ints[1] = displayMetrics.heightPixels;
        return ints;
    }//from   w w  w. j  a  va2s  .c om
}

Related

  1. getScreenHeight(Context context)
  2. getScreenSize(@Nonnull Context context)
  3. getScreenWidth(Context context)
  4. getScreenDensity(Context context)
  5. getScreenSize(Activity ctx)
  6. getScreenSize(Context ctx)
  7. getMinTouchHeight(Context context)
  8. getMinTouchWidth(Context context)
  9. getDisplayHeight(Context context)