List of usage examples for android.util DisplayMetrics DisplayMetrics
public DisplayMetrics()
From source file:Main.java
public static String getScreenSize(Context context) { DisplayMetrics dm = new DisplayMetrics(); WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); wm.getDefaultDisplay().getMetrics(dm); return dm.widthPixels + "x" + dm.heightPixels; }
From source file:Main.java
public static int[] getScreenWH(Activity activity) { int[] WH = { 0, 0 }; DisplayMetrics metrics = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(metrics); WH[0] = metrics.widthPixels;//from w w w . j av a 2 s . c om WH[1] = metrics.heightPixels; return WH; }
From source file:Main.java
public static int getScreenWidthPixels(Context context) { DisplayMetrics dm = new DisplayMetrics(); ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getMetrics(dm); return dm.widthPixels; }
From source file:Main.java
public static float getScrWidth(Context context) { DisplayMetrics metrics = new DisplayMetrics(); WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); manager.getDefaultDisplay().getMetrics(metrics); return metrics.widthPixels; }
From source file:Main.java
public static int getScreenHeight(Context context) { DisplayMetrics metrics = new DisplayMetrics(); ((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(metrics); return metrics.heightPixels; }
From source file:Main.java
public static int getScreenWidth(Context context) { DisplayMetrics metrics = new DisplayMetrics(); ((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(metrics); return metrics.widthPixels; }
From source file:Main.java
public static int getScreenHeight(Activity activity) { DisplayMetrics dm = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(dm); return dm.heightPixels; }
From source file:Main.java
public static float getScrHeight(Context context) { DisplayMetrics metrics = new DisplayMetrics(); WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); manager.getDefaultDisplay().getMetrics(metrics); return metrics.heightPixels; }
From source file:Main.java
public static int getWidth(Activity context) { DisplayMetrics dm = new DisplayMetrics(); context.getWindowManager().getDefaultDisplay().getMetrics(dm); return dm.widthPixels; }
From source file:Main.java
public static int GetScreenWidth(Context context) { DisplayMetrics dm = new DisplayMetrics(); WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); wm.getDefaultDisplay().getMetrics(dm); return dm.widthPixels; }