Java tutorial
//package com.java2s; import android.app.Activity; import android.util.DisplayMetrics; public class Main { private static int mWidthPixels = -1; private static int mHeightPixels = -1; public static int getWindowHeight(Activity activity) { if (mHeightPixels < 0) { DisplayMetrics dm = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(dm); mWidthPixels = dm.widthPixels; mHeightPixels = dm.heightPixels; } return mHeightPixels; } }