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 void getSize(Display display, Point pt) {
    display.getSize(pt);
}

From source file:Main.java

public static Point getScreenSize(Context ctx) {
    WindowManager wm = (WindowManager) ctx.getSystemService(Context.WINDOW_SERVICE);
    Display display = wm.getDefaultDisplay();
    display.getSize(sPoint);
    return sPoint;
}

From source file:Main.java

public static Point getDisplaySize(Display display) {
    Point size = new Point();
    display.getSize(size);
    return size;//from  w  w w .  j  a v  a  2  s .co m
}

From source file:Main.java

private static Point getDefaultDisplaySize(Activity activity, Point size) {
    Display d = activity.getWindowManager().getDefaultDisplay();
    d.getSize(size);

    return size;/*  www .j a  v a 2  s .com*/
}

From source file:Main.java

@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
public static int getDisplayWidthPixel13AndLater(@NonNull Display display) {
    Point size = new Point();
    display.getSize(size);
    return size.x;
}

From source file:Main.java

public static Point getDeviceSize(Context context) {
    Point size = new Point(-1, -1); // invalid size
    if (context == null)
        return size;
    WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    Display display = wm.getDefaultDisplay(); // the display that we see
    display.getSize(size);
    return size;//from   ww  w . j a v  a 2s .  c  o m
}

From source file:Main.java

public static Point getScreenSize(Context context) {
    WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    Display display = wm.getDefaultDisplay();
    Point size = new Point();
    display.getSize(size);
    return size;//  w w w .jav  a 2 s.  c om
}

From source file:Main.java

public static int getDisplayWidth(Context context) {
    WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    Display display = wm.getDefaultDisplay();
    Point size = new Point();
    display.getSize(size);
    return size.x;
}

From source file:Main.java

public static Point getDisplaySize(Context context) {
    WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    Display display = wm.getDefaultDisplay();
    Point size = new Point();
    display.getSize(size);
    int width = size.x;
    int height = size.y;
    return new Point(width, height);
}

From source file:Main.java

public static int getScreenMinWidth(Context context) {
    WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    Display display = wm.getDefaultDisplay();
    Point size = new Point();
    display.getSize(size);
    return Math.min(size.x, size.y);
}