List of usage examples for android.view WindowManager getDefaultDisplay
public Display getDefaultDisplay();
From source file:Main.java
public static int getScreenHeight(Context context) { WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); return wm.getDefaultDisplay().getHeight(); }
From source file:Main.java
public static int getScreenWidth(Context context) { WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); return wm.getDefaultDisplay().getWidth(); }
From source file:Main.java
public static void fontsSize(Context context, float size) { Configuration configuration = context.getResources().getConfiguration(); configuration.fontScale = size;/*from w w w . j a va2 s .com*/ DisplayMetrics metrics = context.getResources().getDisplayMetrics(); WindowManager wm = (WindowManager) context.getSystemService(context.WINDOW_SERVICE); wm.getDefaultDisplay().getMetrics(metrics); metrics.scaledDensity = configuration.fontScale * metrics.density; context.getResources().updateConfiguration(configuration, metrics); }
From source file:Main.java
public static int getScreenWidth(Context context) { WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); manager.getDefaultDisplay().getMetrics(metric); return metric.widthPixels; }
From source file:Main.java
public static int getScreenWidth(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 getDeviceHeight(Context context) { DisplayMetrics dm = new DisplayMetrics(); WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); manager.getDefaultDisplay().getMetrics(dm); return dm.heightPixels; }
From source file:Main.java
public static int getScreenHeight(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 String getDisplay(Context context) { DisplayMetrics dm = new DisplayMetrics(); WindowManager wMgr = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); wMgr.getDefaultDisplay().getMetrics(dm); int width = dm.widthPixels; int height = dm.heightPixels; return width + "*" + height; }
From source file:Main.java
public static int getScreenWidth(Context context) { WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); return wm.getDefaultDisplay().getWidth(); }
From source file:Main.java
public static float getDensity(Context context) { DisplayMetrics metrics = new DisplayMetrics(); WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); manager.getDefaultDisplay().getMetrics(metrics); return metrics.density; }