Example usage for android.app Activity getWindowManager

List of usage examples for android.app Activity getWindowManager

Introduction

In this page you can find the example usage for android.app Activity getWindowManager.

Prototype

public WindowManager getWindowManager() 

Source Link

Document

Retrieve the window manager for showing custom windows.

Usage

From source file:Main.java

/**
 *
 * @param activity//from   w w  w .j av  a 2  s .c  o  m
 * @return
 */
public static int getDisplaySmallerSideSize(Activity activity) {
    Display display = activity.getWindowManager().getDefaultDisplay();
    return Math.min(display.getHeight(), display.getWidth());
}

From source file:Main.java

public static Point getDisplaySize(Activity activity) {
    Display display = activity.getWindowManager().getDefaultDisplay();
    Point size = new Point();
    display.getSize(size);//  w w  w  .j  av  a  2 s . co  m
    return size;
}

From source file:Main.java

public static int getScreenWidth(Activity ctx) {
    Display display = ctx.getWindowManager().getDefaultDisplay();
    DisplayMetrics outMetrics = new DisplayMetrics();
    display.getMetrics(outMetrics);/*  w w  w  .j a  v  a  2  s  . com*/

    float density = ctx.getResources().getDisplayMetrics().density;
    return Math.round(outMetrics.widthPixels);

}

From source file:Main.java

private static void initialSupport(Activity activity, DisplayMetrics dm) {
    activity.getWindowManager().getDefaultDisplay().getMetrics(dm);
}

From source file:Main.java

public static Point getScreenSize(Activity activity) {
    Display display = activity.getWindowManager().getDefaultDisplay();
    Point size = new Point();
    size.set(display.getWidth(), display.getHeight());
    return size;//from w  ww .j  a  v  a  2 s  .c o  m
}

From source file:Main.java

public static float getScreenWidth(Activity activity) {
    Display display = activity.getWindowManager().getDefaultDisplay();
    Point size = new Point();
    display.getSize(size);/*from   w ww  .  jav a  2 s . c o  m*/
    return size.x;
}

From source file:Main.java

public static Point getDisplaySize(Activity activity) {
    Display display = activity.getWindowManager().getDefaultDisplay();
    final Point size = new Point();
    display.getSize(size);//w  w  w.  j  a va2s .  co  m
    return size;
}

From source file:Main.java

public static float getScreenHeight(Activity activity) {
    Display display = activity.getWindowManager().getDefaultDisplay();
    Point size = new Point();
    display.getSize(size);//www.j  a va  2s  .  c  o m
    return size.y;
}

From source file:Main.java

public static Point getSizeOfScreen(Activity activity) {
    Display display = activity.getWindowManager().getDefaultDisplay();
    Point size = new Point();
    display.getSize(size);/*from   w  ww. j a v a 2 s  . com*/
    return size;
}

From source file:Main.java

public static final Point getScreenSize(Activity activity) {
    Display display = activity.getWindowManager().getDefaultDisplay();
    Point size = new Point();
    display.getSize(size);/*from  w w  w  .j a  v a  2 s.co m*/

    return size;
}