List of usage examples for android.app Activity getWindowManager
public WindowManager getWindowManager()
From source file:Main.java
public static int getScreenWidth(Activity mActivity) { DisplayMetrics dm = new DisplayMetrics(); mActivity.getWindowManager().getDefaultDisplay().getMetrics(dm); return dm.widthPixels; }
From source file:Main.java
public static int getScreenWidth(Activity activity) { DisplayMetrics metric = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(metric); return metric.widthPixels; }
From source file:Main.java
public static int getScreenHeight(Activity activity) { DisplayMetrics metric = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(metric); return metric.heightPixels; }
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 static int getScreenHeightPixels(Activity context) { DisplayMetrics metric = new DisplayMetrics(); context.getWindowManager().getDefaultDisplay().getMetrics(metric); return metric.heightPixels; }
From source file:Main.java
public static boolean isTablet(Activity activity) { DisplayMetrics dm = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(dm); double diagonalPixels = Math.sqrt(Math.pow(dm.widthPixels, 2) + Math.pow(dm.heightPixels, 2)); double physicalSize = diagonalPixels / (160 * dm.density); return physicalSize > 7; }
From source file:Main.java
public static int getWindowHeight(Activity activity) { DisplayMetrics metric = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(metric); return metric.heightPixels; }
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 getWindowHeight(Activity activity) { DisplayMetrics metrics = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(metrics); return metrics.heightPixels; }
From source file:Main.java
public static int getScreenHeight(Activity activity) { DisplayMetrics metrics = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(metrics); return metrics.heightPixels; }