Java tutorial
//package com.java2s; import android.app.Activity; import android.content.Context; import android.graphics.Rect; import android.util.DisplayMetrics; import android.view.WindowManager; public class Main { public static int getWindowHeight(Activity activity) { return getScreenHeight(activity) - getStatusBarHeight(activity); } public static int getScreenHeight(Context context) { DisplayMetrics metrics = new DisplayMetrics(); WindowManager manager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); manager.getDefaultDisplay().getMetrics(metrics); return metrics.heightPixels; } public static int getStatusBarHeight(Activity activity) { Rect outRect = new Rect(); activity.getWindow().getDecorView().getWindowVisibleDisplayFrame(outRect); return outRect.top; } }