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 Point getScreenDisplaySize(Context context) {
    WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    Display display = wm.getDefaultDisplay();
    Point point = new Point();
    if (Build.VERSION.SDK_INT >= 13) {
        display.getSize(point);/* w w w. ja va2  s . com*/
    } else {
        point = new Point(display.getWidth(), display.getHeight());
    }

    return point;
}

From source file:Main.java

@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
public static int getRealHeight(Display display) {
    int height;//from w  w w  .j av  a  2s . com
    try {
        Point size = new Point();
        display.getRealSize(size);
        height = size.y;
    } catch (NoSuchMethodError e) {
        height = display.getHeight();
    }
    return height;
}

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();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
        display.getSize(size);/*from  www  .j a  va2 s .c om*/
    } else {
        size.set(display.getWidth(), display.getHeight());
    }

    return size;
}

From source file:Main.java

@SuppressLint("NewApi")
public static void getSize(Display display, Point outSize) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        display.getSize(outSize);/* ww  w  .  j av  a2  s. co  m*/
    } else {
        outSize.x = display.getWidth();
        outSize.y = display.getHeight();
    }
}

From source file:Main.java

public static Point getScreenResolution(Context context) {
    WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    Display display = wm.getDefaultDisplay();
    Point screenResolution = new Point();
    if (android.os.Build.VERSION.SDK_INT >= 13) {
        display.getSize(screenResolution);
    } else {/*w ww  .  java  2  s . c om*/
        screenResolution.set(display.getWidth(), display.getHeight());
    }
    return screenResolution;
}

From source file:Main.java

public static Point getScreenResolution(Context context) {
    WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    Display display = wm.getDefaultDisplay();
    Point screenResolution = new Point();
    if (android.os.Build.VERSION.SDK_INT >= 13) {
        display.getSize(screenResolution);
    } else {//from  www.  ja va2 s  . com
        screenResolution.set(display.getWidth(), display.getHeight());
    }

    return screenResolution;
}

From source file:Main.java

@SuppressWarnings("deprecation")
private static Point getDefaultDisplaySize(Activity activity, Point size) {
    Display d = activity.getWindowManager().getDefaultDisplay();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
        d.getSize(size);/*w  ww.  j  ava2 s .  c o m*/
    } else {
        size.set(d.getWidth(), d.getHeight());
    }
    return size;
}

From source file:Main.java

@SuppressWarnings("deprecation")
@SuppressLint("NewApi")
// Whole Screen includes StatusBar and ActionBar
public static int getHeight(Context context) {

    WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    Display display = wm.getDefaultDisplay();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
        Point size = new Point();
        display.getSize(size);/*from   w w w.  j a  v a 2s .  co  m*/
        return size.y;
    } else
        return display.getHeight();
}

From source file:Main.java

public static int getScreenHeight(Activity activity) {
    Display display = activity.getWindowManager().getDefaultDisplay();
    Point size = new Point();
    int height = 200;
    if (Build.VERSION.SDK_INT > 13) {
        display.getSize(size);//from w w  w . ja  v a  2s . c o m
        height = size.y;
    } else {
        height = display.getHeight();
    }
    return height;
}

From source file:Main.java

public static Point getScreenSize(Context applicationContext) {

    WindowManager wm = (WindowManager) applicationContext.getSystemService(Context.WINDOW_SERVICE);
    Display display = wm.getDefaultDisplay();
    Point size = new Point();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2)
        display.getSize(size);//  www. ja v a 2 s  .  co m
    else {
        size.x = display.getWidth();
        size.y = display.getHeight();
    }
    return size;
}