List of usage examples for android.util DisplayMetrics DisplayMetrics
public DisplayMetrics()
From source file:Main.java
public static int getDisplayHeight(Activity activity) { DisplayMetrics displaymetrics = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); return displaymetrics.heightPixels; }
From source file:Main.java
public static float getScreenensity(Activity mActivity) { DisplayMetrics metric = new DisplayMetrics(); mActivity.getWindowManager().getDefaultDisplay().getMetrics(metric); float density = metric.density; return density; }
From source file:Main.java
public static DisplayMetrics getScreenInfo(Activity activity) { DisplayMetrics dm = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(dm); return dm;/* ww w . ja v a2s . c o m*/ }
From source file:Main.java
public static int getScreenWidth(Activity activity) { DisplayMetrics displaymetrics = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); int width = displaymetrics.widthPixels; return width; }
From source file:Main.java
public static DisplayMetrics getDisplayMetrics(Activity act) { DisplayMetrics metrics = new DisplayMetrics(); act.getWindowManager().getDefaultDisplay().getMetrics(metrics); return metrics; }
From source file:Main.java
public static DisplayMetrics getDisplayMetrics(Context context) { DisplayMetrics dm = new DisplayMetrics(); dm = context.getResources().getDisplayMetrics(); return dm;/* w w w. ja v a 2s . c om*/ }
From source file:Main.java
public static int calculateCellDimension(Activity context) { DisplayMetrics displaymetrics = new DisplayMetrics(); context.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); return displaymetrics.widthPixels / 3; }
From source file:Main.java
public static int getScreenPixWidth(Activity activity) { DisplayMetrics displayMetrics = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); return displayMetrics.widthPixels; }
From source file:Main.java
public static int getScreenPixHeight(Activity activity) { DisplayMetrics displayMetrics = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); return displayMetrics.heightPixels; }
From source file:Main.java
private static DisplayMetrics getDisplayMetrics(Context context) { DisplayMetrics dm = new DisplayMetrics(); dm = context.getApplicationContext().getResources().getDisplayMetrics(); return dm;/*from ww w. j a va2 s.co m*/ }