List of usage examples for android.view Display getHeight
@Deprecated public int getHeight()
From source file:Main.java
@SuppressWarnings("deprecation") private static void getDisplaySizeV9(Display display, Point outSize) { outSize.x = display.getWidth();/*from ww w. j av a2s.co m*/ outSize.y = display.getHeight(); }
From source file:Main.java
public static int getScreenHeight(Context context) { int height = 0; Display disp = ((Activity) context).getWindowManager().getDefaultDisplay(); height = disp.getHeight(); return height; }
From source file:Main.java
/** * calculate dynamic height of screen/*w w w.j a v a2 s . c o m*/ * * @param activity * @return */ public static int setDynamicHeight(Activity activity) { Display display = (activity).getWindowManager().getDefaultDisplay(); int height = display.getHeight(); return height; }
From source file:Main.java
public static int[] getScreenSize(Context context) { WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); Display display = manager.getDefaultDisplay(); return new int[] { display.getWidth(), display.getHeight() }; }
From source file:Main.java
/** * Get current {@link Activity} screen height. * //from w w w . j a v a 2 s .c o m * @param activity Object of {@link Activity} * @return Screen height, failed will return 0. */ public final static int getScreenHeight(Activity activity) { if (null == activity) { return 0; } try { Display d = activity.getWindowManager().getDefaultDisplay(); return d.getHeight(); } catch (Exception e) { e.printStackTrace(); return 0; } }
From source file:Main.java
public static boolean isLandscapeMode(Activity activity) { Display d = activity.getWindowManager().getDefaultDisplay(); if (d.getWidth() > d.getHeight()) return true; else/*from w w w. ja v a2 s. c om*/ return false; }
From source file:Main.java
public static Point getScreenResolution(Context context) { WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); Display display = manager.getDefaultDisplay(); Point wh = new Point(display.getWidth(), display.getHeight()); if (wh.x == 0 || wh.y == 0) { Log.e("AndroidUtils", "Screen resolution " + wh + " for " + context); }/* w w w . j a v a 2 s .c o m*/ return wh; }
From source file:Main.java
public static Rect getDisplaySize(Context context) { Rect rect = new Rect(); WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); Display display = manager.getDefaultDisplay(); rect.set(0, 0, display.getWidth(), display.getHeight()); return rect;/*from www .ja v a 2 s.c om*/ }
From source file:Main.java
/** * Returns the screen/display size/* w w w .ja v a 2 s . c o m*/ * * @param context * @return */ @SuppressWarnings("deprecation") public static Point getDisplaySize(Context context) { WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); Display display = wm.getDefaultDisplay(); int width = display.getWidth(); int height = display.getHeight(); return new Point(width, height); }
From source file:Main.java
public static int getHeightScreen(Context context) { Display display = ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay(); return display.getHeight(); }