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

public static int getScreenWidth(Activity activity) {
    DisplayMetrics dm = new DisplayMetrics();
    activity.getWindowManager().getDefaultDisplay().getMetrics(dm);
    int screenWidth = dm.widthPixels;
    return screenWidth;
}

From source file:Main.java

public static DisplayMetrics getScreenInfo(Activity activity) {
    DisplayMetrics dm = new DisplayMetrics();
    activity.getWindowManager().getDefaultDisplay().getMetrics(dm);
    return dm;// w w w .j a va  2 s .com
}

From source file:Main.java

public static int getHeight(Activity context) {
    DisplayMetrics dm = new DisplayMetrics();
    context.getWindowManager().getDefaultDisplay().getMetrics(dm);
    return dm.heightPixels;
}

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 int getWidth(Activity context) {
    DisplayMetrics dm = new DisplayMetrics();
    context.getWindowManager().getDefaultDisplay().getMetrics(dm);
    int screenWidth = dm.widthPixels;
    return screenWidth;
}

From source file:Main.java

public static int getScreenHeight(Activity activity) {
    DisplayMetrics dm = new DisplayMetrics();
    activity.getWindowManager().getDefaultDisplay().getMetrics(dm);
    int screenHeight = dm.heightPixels;
    return screenHeight;
}

From source file:Main.java

public static int getScreenHeight(Activity context) {
    DisplayMetrics dm = new DisplayMetrics();
    context.getWindowManager().getDefaultDisplay().getMetrics(dm);
    int mScreenHeight = dm.heightPixels;
    return mScreenHeight;
}

From source file:Main.java

public static int getResolution(Activity act) {
    int Width = 0;
    int Height = 0;
    Width = act.getWindowManager().getDefaultDisplay().getWidth();
    Height = act.getWindowManager().getDefaultDisplay().getHeight();
    return Width * Height;
}

From source file:Main.java

public static int getWindowWidth(Activity context) {
    DisplayMetrics metric = new DisplayMetrics();
    context.getWindowManager().getDefaultDisplay().getMetrics(metric);
    return metric.widthPixels;
}

From source file:Main.java

public static String getScreenParams(Activity activity) {
    DisplayMetrics dm = new DisplayMetrics();
    activity.getWindowManager().getDefaultDisplay().getMetrics(dm);
    return "&screen=" + (dm.heightPixels > dm.widthPixels ? dm.widthPixels + "*" + dm.heightPixels
            : dm.heightPixels + "*" + dm.widthPixels);
}