Java tutorial
//package com.java2s; import android.annotation.TargetApi; import android.content.Context; import android.graphics.Point; import android.os.Build; import android.view.Display; import android.view.WindowManager; public class Main { @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; 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; } }