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

@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
public static int getScreenWidth(Activity screen) {
    Display display = screen.getWindowManager().getDefaultDisplay();
    Point size = new Point();
    display.getSize(size);/* w  w w  .j  a  v a 2  s  .co m*/
    return size.x;
}

From source file:Main.java

private static Point getDisplaySize(Activity activity) {
    Display display = activity.getWindowManager().getDefaultDisplay();
    Point size = new Point();
    display.getSize(size);//from  www  .  java 2s .com
    return size;
}

From source file:Main.java

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

    return size;
}

From source file:Main.java

@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
public static int getScreenHeight(Activity screen) {
    Display display = screen.getWindowManager().getDefaultDisplay();
    Point size = new Point();
    display.getSize(size);//from w  w w  . j  a va 2s  .  c  om
    return size.y;
}

From source file:Main.java

public static int getScreenRotation(Activity activity) {
    switch (activity.getWindowManager().getDefaultDisplay().getRotation()) {
    default:// ww w  . j  av  a  2  s  . c o  m
    case Surface.ROTATION_0:
        return 0;
    case Surface.ROTATION_90:
        return 90;
    case Surface.ROTATION_180:
        return 180;
    case Surface.ROTATION_270:
        return 270;
    }
}

From source file:Main.java

public static DisplayMetrics getScreenMetrics(Activity activity) {

    Display display = activity.getWindowManager().getDefaultDisplay();
    DisplayMetrics outMetrics = new DisplayMetrics();
    display.getMetrics(outMetrics);//w  ww .  ja v  a 2  s.  c  o m

    return outMetrics;
}

From source file:Main.java

public static int getScreenHeight(Activity activity) {

    Display display = activity.getWindowManager().getDefaultDisplay();
    DisplayMetrics outMetrics = new DisplayMetrics();
    display.getMetrics(outMetrics);//from w  w w  .ja va  2  s .  c o m

    return outMetrics.heightPixels;
}

From source file:Main.java

public static int getDisplayWidth(Activity mactivity) {
    return mactivity.getWindowManager().getDefaultDisplay().getWidth();
}

From source file:Main.java

private static Point getDefaultDisplaySize(Activity activity, Point size) {
    Display d = activity.getWindowManager().getDefaultDisplay();
    d.getSize(size);//from  w w w .j  a  va  2  s . c o m

    return size;
}

From source file:Main.java

public static Point getDisplaySize(Activity activity) {
    Display display = activity.getWindowManager().getDefaultDisplay();
    Point size = new Point();
    display.getSize(size);/*from www .j  a va 2s .co m*/
    width = size.x;
    height = size.y;
    return size;
}