List of usage examples for android.app Activity getWindowManager
public WindowManager getWindowManager()
From source file:Main.java
public static float getDensity(Activity activity) { DisplayMetrics dm = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(dm); return dm.density; }
From source file:Main.java
@SuppressWarnings("deprecation") public static int getDeviceHeight(Activity activity) { if (deviceHeight == 0) { deviceHeight = activity.getWindowManager().getDefaultDisplay().getHeight(); }/* w ww . ja va 2 s .co m*/ return deviceHeight; }
From source file:Main.java
/** * Gets device's display resolution./* w w w .j a v a2 s . c om*/ * @since 0.1.0 * @param aActivity The activity from which the window's information is retrieved. * @return The struct of Point with x attribute contains the width and y attribute contains the height. */ public static Point getDisplayResolution(Activity aActivity) { Point p = new Point(); aActivity.getWindowManager().getDefaultDisplay().getSize(p); return p; }
From source file:Main.java
public static float getScreenensity(Activity context) { DisplayMetrics metric = new DisplayMetrics(); context.getWindowManager().getDefaultDisplay().getMetrics(metric); float density = metric.density; return density; }
From source file:Main.java
public static DisplayMetrics getScreenDisplayMetrics(Activity context) { DisplayMetrics metric = new DisplayMetrics(); context.getWindowManager().getDefaultDisplay().getMetrics(metric); return metric; }
From source file:Main.java
public static int getScreenDpi(Activity activity) { DisplayMetrics metrics = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(metrics); return metrics.densityDpi; }
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 int calculateCellDimension(Activity context) { DisplayMetrics displaymetrics = new DisplayMetrics(); context.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); return displaymetrics.widthPixels / 3; }
From source file:Main.java
public static DisplayMetrics getWindowMetrics(Activity activity) { DisplayMetrics metrics = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(metrics); return metrics; }
From source file:Main.java
public static int getScreenHeight(Activity mActivity) { DisplayMetrics metric = new DisplayMetrics(); mActivity.getWindowManager().getDefaultDisplay().getMetrics(metric); return metric.heightPixels; }