Example usage for android.view Display getSize

List of usage examples for android.view Display getSize

Introduction

In this page you can find the example usage for android.view Display getSize.

Prototype

public void getSize(Point outSize) 

Source Link

Document

Gets the size of the display, in pixels.

Usage

From source file:Main.java

public static float getScreenHeight(Activity activity) {
    Display display = activity.getWindowManager().getDefaultDisplay();
    Point size = new Point();
    display.getSize(size);
    return size.y;
}

From source file:Main.java

public static int getScreenWidth(Context context) {
    WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    Display display = manager.getDefaultDisplay();
    Point point = new Point();
    display.getSize(point);
    return point.x;
}

From source file:Main.java

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

From source file:Main.java

public static final Point getScreenSize(Activity activity) {
    Display display = activity.getWindowManager().getDefaultDisplay();
    Point size = new Point();
    display.getSize(size);

    return size;/*w w  w  .  j a  v  a  2 s. c o  m*/
}

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);
    return size.x;
}

From source file:Main.java

public static Point getScreenSize(@Nullable Activity activity) {
    Display display = activity.getWindowManager().getDefaultDisplay();
    Point point = new Point();
    display.getSize(point);
    return point;
}

From source file:Main.java

private static Point getDisplaySize(Activity activity) {
    Display display = activity.getWindowManager().getDefaultDisplay();
    Point size = new Point();
    display.getSize(size);
    return size;//from   w  w  w .ja v  a2 s. c om
}

From source file:Main.java

public static Point getDisplayScreenSize(Activity activity) {
    Display display = activity.getWindowManager().getDefaultDisplay();
    Point size = new Point();
    display.getSize(size);

    return size;/*w ww.j  av  a  2 s  .c  o m*/
}

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);
    return size.y;
}

From source file:Main.java

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