List of usage examples for android.util DisplayMetrics DisplayMetrics
public DisplayMetrics()
From source file:Main.java
public static int getHeighPixels(Context context) { DisplayMetrics dm = new DisplayMetrics(); ((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(dm); return dm.heightPixels; }
From source file:Main.java
public static int GET_SCREEN_WIDTH(Activity a) { int screenWidth = 0; DisplayMetrics dm = new DisplayMetrics(); a.getWindowManager().getDefaultDisplay().getMetrics(dm); screenWidth = dm.widthPixels;//from w ww .ja v a 2 s. c o m return screenWidth; }
From source file:Main.java
public static int getScreenHeight(Context context) { DisplayMetrics dm = new DisplayMetrics(); ((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(dm); return dm.heightPixels; }
From source file:Main.java
public static int getWidthPixels(Context context) { DisplayMetrics dm = new DisplayMetrics(); ((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(dm); return dm.widthPixels; }
From source file:Main.java
public static int[] getScreenSize(Context context) { DisplayMetrics metrics = new DisplayMetrics(); ((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(metrics); return new int[] { metrics.widthPixels, metrics.heightPixels }; }
From source file:Main.java
public static int getWidth(Activity n) { DisplayMetrics dm = new DisplayMetrics(); initialSupport(n, dm); return dm.widthPixels; }
From source file:Main.java
public static void setScannerWidth(Activity ac) { DisplayMetrics dm = new DisplayMetrics(); ac.getWindowManager().getDefaultDisplay().getMetrics(dm); SCANNER_WIDT = dm.widthPixels;//ww w . ja v a 2 s . c o m }
From source file:Main.java
public static int convertDpToPixels(WindowManager windowManager, float dp) { DisplayMetrics metrics = new DisplayMetrics(); windowManager.getDefaultDisplay().getMetrics(metrics); float logicalDensity = metrics.density; return (int) (dp * logicalDensity + 0.5); }
From source file:Main.java
public static DisplayMetrics getMetrics(Context context) { DisplayMetrics dm = new DisplayMetrics(); ((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(dm); return dm;/*from w w w . ja v a 2 s . c o m*/ }
From source file:Main.java
public static int getScreenWidth(Context context) { DisplayMetrics displaymetrics = new DisplayMetrics(); ((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); return displaymetrics.widthPixels; }