List of usage examples for android.util DisplayMetrics DisplayMetrics
public DisplayMetrics()
From source file:Main.java
public static DisplayMetrics getScreenWH(Context context) { DisplayMetrics displayMetrics = new DisplayMetrics(); displayMetrics = context.getResources().getDisplayMetrics(); return displayMetrics; }
From source file:Main.java
public static float computeY(Activity activity, float val) { DisplayMetrics displayMetrics = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); int h = displayMetrics.heightPixels; return val * ((float) h / 1200.0f); }
From source file:Main.java
public static float getScreenWidthDp(Activity act) { final DisplayMetrics displayMetrics = new DisplayMetrics(); act.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); float midu = (float) displayMetrics.densityDpi; return displayMetrics.widthPixels / (midu / 160); }
From source file:Main.java
public static String getScreenDimensionsString(Activity activity) { DisplayMetrics metrics = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(metrics); int h = metrics.heightPixels; int w = metrics.widthPixels; return w + "x" + h; }
From source file:Main.java
public static String getDisplay(WindowManager windowManager) { DisplayMetrics metrics = new DisplayMetrics(); windowManager.getDefaultDisplay().getMetrics(metrics); int ScreenWidth = metrics.widthPixels; int ScreenHeight = metrics.heightPixels; String displayInfo = ScreenWidth + "," + ScreenHeight; return displayInfo; }
From source file:Main.java
public static int getWindowHeight(Context context) { DisplayMetrics dm = new DisplayMetrics(); ((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(dm); return dm.heightPixels; }
From source file:Main.java
public static String getResolution(Context context) { DisplayMetrics dm = new DisplayMetrics(); ((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(dm); return dm.widthPixels + "x" + dm.heightPixels; }
From source file:Main.java
public static int getPhoneWH(Context context) { DisplayMetrics dm = new DisplayMetrics(); ((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(dm); int disH = dm.heightPixels; return disH;// w ww.j a va 2s . c om }
From source file:Main.java
public static int getScreenWidth(Context context) { DisplayMetrics dm = new DisplayMetrics(); ((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(dm); return dm.widthPixels; }
From source file:Main.java
public static int getPhoneHW(Context context) { DisplayMetrics dm = new DisplayMetrics(); ((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(dm); int disW = dm.widthPixels; return disW;/*from www .j a va 2 s. co m*/ }