Java tutorial
//package com.java2s; import android.content.Context; import android.graphics.Point; import android.view.WindowManager; public class Main { private static int screenHeight = -1; public static int getScreenHeight(Context context) { if (screenHeight != -1) { return screenHeight; } Point size = new Point(); ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getSize(size); screenHeight = size.y; return screenHeight; } }