List of usage examples for android.util DisplayMetrics DisplayMetrics
public DisplayMetrics()
From source file:Main.java
public static float getDisplayParams(Context context) { DisplayMetrics dm = new DisplayMetrics(); dm = context.getApplicationContext().getResources().getDisplayMetrics(); return dm.density; }
From source file:Main.java
public static int getScreentHeight(Context context) { DisplayMetrics dm = new DisplayMetrics(); dm = context.getResources().getDisplayMetrics(); int height = dm.heightPixels; return height; }
From source file:Main.java
public static int[] getDeviceMetrics(Activity activity) { DisplayMetrics dm = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(dm); int screenWidth = dm.widthPixels; int screenHeight = dm.heightPixels; return new int[] { screenWidth, screenHeight }; }
From source file:Main.java
public static int getScreenHeight(Activity context) { DisplayMetrics metric = new DisplayMetrics(); context.getWindowManager().getDefaultDisplay().getMetrics(metric); int height = metric.heightPixels; return height; }
From source file:Main.java
public static int getScreenWidthPixels(Activity context) { DisplayMetrics metric = new DisplayMetrics(); context.getWindowManager().getDefaultDisplay().getMetrics(metric); return metric.widthPixels; }
From source file:Main.java
public final static int getWindowsWidth(Activity activity) { DisplayMetrics dm = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(dm); return dm.widthPixels; }
From source file:Main.java
public static float getScreenDensity(Activity activity) { DisplayMetrics metric = new DisplayMetrics(); activity.getWindow().getWindowManager().getDefaultDisplay().getMetrics(metric); return metric.density; }
From source file:Main.java
public static DisplayMetrics GetScreenSize(Activity act) { DisplayMetrics metrics = new DisplayMetrics(); act.getWindowManager().getDefaultDisplay().getMetrics(metrics); return metrics; }
From source file:Main.java
public static int getScreenHeightPixels(Activity context) { DisplayMetrics metric = new DisplayMetrics(); context.getWindowManager().getDefaultDisplay().getMetrics(metric); return metric.heightPixels; }
From source file:Main.java
public static int getScreenWidth(Activity activity) { DisplayMetrics displaymetrics = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); return displaymetrics.widthPixels; }