List of usage examples for android.view WindowManager getDefaultDisplay
public Display getDefaultDisplay();
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 getWindowWidth(Context context) { WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); return wm.getDefaultDisplay().getWidth(); }
From source file:Main.java
public static int getScreenWidth() { WindowManager wm = (WindowManager) sContext.getSystemService(Context.WINDOW_SERVICE); return wm.getDefaultDisplay().getWidth(); }
From source file:Main.java
public static int getDisplayHeight(Context context) { DisplayMetrics displayMetrics = new DisplayMetrics(); WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); wm.getDefaultDisplay().getMetrics(displayMetrics); int displayHeight = displayMetrics.heightPixels; return displayHeight; }
From source file:Main.java
public static float getScreenDPI(Context context) { final DisplayMetrics displayMetrics = new DisplayMetrics(); WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); wm.getDefaultDisplay().getMetrics(displayMetrics); return (float) displayMetrics.densityDpi; }
From source file:Main.java
public static int getDisplayWidth(Context context) { DisplayMetrics displayMetrics = new DisplayMetrics(); WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); wm.getDefaultDisplay().getMetrics(displayMetrics); int displayWidth = displayMetrics.widthPixels; return displayWidth; }
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; }
From source file:Main.java
public static int getDeviceWidth(Context context) { int width = 0; DisplayMetrics dm = new DisplayMetrics(); WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); wm.getDefaultDisplay().getMetrics(dm); width = dm.widthPixels;/*w ww .j a va 2s.com*/ return width; }
From source file:Main.java
public static String getDisplay(WindowManager windowManager) { DisplayMetrics metrics = new DisplayMetrics(); windowManager.getDefaultDisplay().getMetrics(metrics); int ScreenWidth = metrics.widthPixels; int ScreenHeight = metrics.heightPixels; String displayInfo = ScreenWidth + "," + ScreenHeight; return displayInfo; }
From source file:Main.java
@SuppressWarnings("deprecation") public static int getDisplayMetricsHeight(Context mContext) { WindowManager wm = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE); return wm.getDefaultDisplay().getHeight(); }