List of usage examples for android.content Context WINDOW_SERVICE
String WINDOW_SERVICE
To view the source code for android.content Context WINDOW_SERVICE.
Click Source Link
From source file:Main.java
public static float getScreenWidthPPI(Context context) { WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); DisplayMetrics outMetrics = new DisplayMetrics(); wm.getDefaultDisplay().getMetrics(outMetrics); return outMetrics.xdpi; }
From source file:Main.java
public static float getScreenHeightPPI(Context context) { WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); DisplayMetrics outMetrics = new DisplayMetrics(); wm.getDefaultDisplay().getMetrics(outMetrics); return outMetrics.ydpi; }
From source file:Main.java
public static int getDeviceDPI(Context context) { DisplayMetrics metrics = new DisplayMetrics(); WindowManager mgr = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); mgr.getDefaultDisplay().getMetrics(metrics); return metrics.densityDpi; }
From source file:Main.java
public static Point getAppUsableScreenSize(Context context) { WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); Display display = windowManager.getDefaultDisplay(); Point size = new Point(); display.getSize(size);/*from w ww . j av a 2s . co m*/ return size; }
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 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 double getDeviceXDPI(Context context) { DisplayMetrics metrics = new DisplayMetrics(); WindowManager mgr = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); mgr.getDefaultDisplay().getMetrics(metrics); return metrics.xdpi; }
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 float getDeviceDensity(Context context) { DisplayMetrics metrics = new DisplayMetrics(); WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); wm.getDefaultDisplay().getMetrics(metrics); return metrics.density; }
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; }