Example usage for android.view Display getHeight

List of usage examples for android.view Display getHeight

Introduction

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

Prototype

@Deprecated
public int getHeight() 

Source Link

Usage

From source file:Main.java

public static int[] getScreenDimension(Display display) {
    int[] dimension = new int[2];
    dimension[0] = display.getWidth();//from w ww .  j  av a  2  s.  c  o m
    dimension[1] = display.getHeight();

    return dimension;
}

From source file:Main.java

@SuppressWarnings("deprecation")
/**//  w w  w.  j  ava 2s  .c om
 * Returns the screen/display size
 *
 * @param ctx
 * @return
 */
public static Point getDisplaySize(Context context) {
    WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    Display display = wm.getDefaultDisplay();
    int width = display.getWidth();
    int height = display.getHeight();
    return new Point(width, height);
}

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  av  a2  s  . c o  m*/
}

From source file:Main.java

public static boolean is_tablet(Context ctx) {
    Display display = ((Activity) ctx).getWindowManager().getDefaultDisplay();
    int width = display.getWidth();
    int height = display.getHeight();

    if ((width > 1000) || (height > 1000))
        return true;
    else/*from   ww  w  . ja v a 2 s  .c o m*/
        return false;
}

From source file:Main.java

public static int getScreenOrientation(Context context) {
    WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    Display display = wm.getDefaultDisplay();

    int orientation = Configuration.ORIENTATION_UNDEFINED;
    if (display.getWidth() == display.getHeight()) {
        orientation = Configuration.ORIENTATION_SQUARE;
    } else {//from ww  w .j  a  va  2  s.c  om
        if (display.getWidth() < display.getHeight()) {
            orientation = Configuration.ORIENTATION_PORTRAIT;
        } else {
            orientation = Configuration.ORIENTATION_LANDSCAPE;
        }
    }
    return orientation;
}

From source file:Main.java

public static int getOrientation(Context context) {
    WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    Display getOrient = windowManager.getDefaultDisplay();
    int orientation = Configuration.ORIENTATION_UNDEFINED;
    if (getOrient.getWidth() == getOrient.getHeight()) {
        orientation = Configuration.ORIENTATION_SQUARE;
    } else {/*  w ww . ja v a 2 s . c  om*/
        if (getOrient.getWidth() < getOrient.getHeight()) {
            orientation = Configuration.ORIENTATION_PORTRAIT;
        } else {
            orientation = Configuration.ORIENTATION_LANDSCAPE;
        }
    }
    return orientation;
}

From source file:Main.java

@SuppressWarnings("deprecation")
public static int getWindowHeight(Context context) {
    Display display = ((WindowManager) context.getApplicationContext().getSystemService(Context.WINDOW_SERVICE))
            .getDefaultDisplay();/*from   w w w. ja v  a2 s.  co  m*/
    return display.getHeight();
}

From source file:Main.java

public static int getScreenOrientation(Context context) {
    Display display = getDefaultDisplay(context);
    int orientation = Configuration.ORIENTATION_UNDEFINED;
    if (display.getWidth() == display.getHeight())
        orientation = Configuration.ORIENTATION_SQUARE;
    else {/*ww w  .  j a v  a 2  s.  c  o  m*/
        if (display.getWidth() < display.getHeight())
            orientation = Configuration.ORIENTATION_PORTRAIT;
        else
            orientation = Configuration.ORIENTATION_LANDSCAPE;
    }

    return orientation;
}

From source file:Main.java

public static Point getScreenSize(Context context) {
    if (screenSize != null) {
        return screenSize;
    }/*from w w w .jav  a 2s  .c om*/
    int pxWidth;
    int pxHeight;

    Display display = ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
    pxWidth = display.getWidth();
    pxHeight = display.getHeight();

    screenSize = new Point(pxWidth, pxHeight);
    return screenSize;
}

From source file:Main.java

@SuppressWarnings("deprecation")
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
public static int getScreenHeight(Context ctx) {
    WindowManager wm = (WindowManager) ctx.getSystemService(Context.WINDOW_SERVICE);
    Display display = wm.getDefaultDisplay();
    int height;/*from  w  w  w . j ava  2  s  .  c om*/
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB_MR2) {
        height = display.getHeight(); // deprecated
    } else {
        Point size = new Point();
        display.getSize(size);
        height = size.y;
    }

    return height;
}