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 int getScreenHeight(Context c) { WindowManager windowManager = (WindowManager) c.getSystemService(Context.WINDOW_SERVICE); Display display = windowManager.getDefaultDisplay(); Point point = new Point(); display.getSize(point);//from w w w . ja v a2 s . co m return point.y; }
From source file:Main.java
public static Point getDisplaySize(Context context) { WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); Display display = wm.getDefaultDisplay(); Point size = new Point(); display.getSize(size);//from w ww .ja v a 2s .c om int width = size.x; int height = size.y; return new Point(width, height); }
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 int getScreenWidth(Context context) { int screenWidth; WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); DisplayMetrics dm = new DisplayMetrics(); wm.getDefaultDisplay().getMetrics(dm); screenWidth = dm.widthPixels;// w w w.j ava 2 s . c om return screenWidth; }
From source file:Main.java
public static int getScreenWidth(Context context) { WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); Display display = wm.getDefaultDisplay(); DisplayMetrics metrics = new DisplayMetrics(); display.getMetrics(metrics);//from w ww . j a va2 s. co m return metrics.widthPixels; }
From source file:Main.java
public static int getHeightScreen(Context context) { WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); Display display = windowManager.getDefaultDisplay(); Point size = new Point(); display.getSize(size);//from w w w . j av a2s. c om return size.y; }
From source file:Main.java
@SuppressWarnings("deprecation") public static int getScreenWidth(Context context) { WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); Display display = manager.getDefaultDisplay(); return display.getWidth(); }
From source file:Main.java
public static int px2dp(Context context, int px) { WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); Display display = wm.getDefaultDisplay(); DisplayMetrics displaymetrics = new DisplayMetrics(); display.getMetrics(displaymetrics);/* w ww .j a va 2 s.c o m*/ return (int) (px / displaymetrics.density + 0.5f); }
From source file:Main.java
@SuppressWarnings("deprecation") public static int getScreenHeight(Context context) { WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); Display display = manager.getDefaultDisplay(); return display.getHeight(); }
From source file:Main.java
public static int getScreenHeight(Context context) { WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); Display display = wm.getDefaultDisplay(); DisplayMetrics metrics = new DisplayMetrics(); display.getMetrics(metrics);//from w w w . ja v a2 s. c om return metrics.heightPixels; }