List of usage examples for android.view Display getSize
public void getSize(Point outSize)
From source file:Main.java
public static Point getDisplaySize(Activity activity) { Display display = activity.getWindowManager().getDefaultDisplay(); Point size = new Point(); display.getSize(size); width = size.x;// w w w .j a va2 s.c o m height = size.y; return size; }
From source file:Main.java
public static Point getScreenDimensions(Context context) { WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); Display display = wm.getDefaultDisplay(); Point dimensions = new Point(); display.getSize(dimensions); return dimensions; }
From source file:Main.java
public static Point getDisplaySize(Activity activity) { Display display = activity.getWindowManager().getDefaultDisplay(); final Point size = new Point(); display.getSize(size); return size;//from w ww. ja v a2 s. c o m }
From source file:Main.java
/** * Get a value by percentage of the Screen. * * @param activity - Current Activity// w w w. j a v a2 s . c o m * @param value - The percentage * @return - A value represent the percentage */ public static int getYPercentageFromScreen(Activity activity, float value) { Display display = activity.getWindowManager().getDefaultDisplay(); Point size = new Point(); display.getSize(size); return (int) (size.y * value) / 100; }
From source file:Main.java
public static Point libgdxToScreenCoordinates(Context context, float x, float y) { WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); Display display = wm.getDefaultDisplay(); Point size = new Point(); display.getSize(size); // Log.d(CucumberInstrumentation.TAG, String.format("center: [%d/%d]", size.x / 2, size.y / 2)); Point point = new Point(); point.x = Math.round((size.x / 2f) + x); point.y = Math.round((size.y / 2f) + y); // Log.d(CucumberInstrumentation.TAG, String.format("coords: [%d/%d]", point.x, point.y)); return point; }
From source file:Main.java
@TargetApi(Build.VERSION_CODES.KITKAT) public static ImageReader createImageReader(Activity c) { DisplayMetrics metrics = c.getResources().getDisplayMetrics(); int density = metrics.densityDpi; int flags = DisplayManager.VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR | DisplayManager.VIRTUAL_DISPLAY_FLAG_PUBLIC; //DisplayManager.VIRTUAL_DISPLAY_FLAG_OWN_CONTENT_ONLY | DisplayManager.VIRTUAL_DISPLAY_FLAG_PUBLIC; Display display = c.getWindowManager().getDefaultDisplay(); Point size = new Point(); display.getSize(size); return ImageReader.newInstance(size.x, size.y, PixelFormat.RGB_565, 2); }
From source file:Main.java
public static int GetScreenHeight(Context context) { Display display = ((Activity) context).getWindowManager().getDefaultDisplay(); Point size = new Point(); display.getSize(size); return size.y; }
From source file:Main.java
public static int GetScreenWidth(Context context) { Display display = ((Activity) context).getWindowManager().getDefaultDisplay(); Point size = new Point(); display.getSize(size); return size.x; }
From source file:Main.java
public static float getScreenWidth(Context context) { Display display = ((Activity) context).getWindowManager().getDefaultDisplay(); Point size = new Point(); display.getSize(size); return size.x; }
From source file:Main.java
public static Point getScreenSize(Activity activity) { Display display = activity.getWindowManager().getDefaultDisplay(); Point size = new Point(); display.getSize(size); return size;/*from w w w. j av a 2 s. c om*/ }