Java tutorial
//package com.java2s; import android.app.Activity; import android.util.DisplayMetrics; public class Main { private static int fillWidth = 0; private static int fillHeight = 0; public static int getFillHeight(Activity activity) { if (fillHeight == 0) { initFillWidthAndHeight(activity); } return fillHeight; } public static void initFillWidthAndHeight(Activity activity) { DisplayMetrics dm = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(dm); fillWidth = dm.widthPixels; fillHeight = dm.heightPixels; } }