Java tutorial
//package com.java2s; import android.content.Context; import android.util.DisplayMetrics; public class Main { private static int SCREEN_HEIGHT = 0; public static int getScreenHeight(Context context) { if (SCREEN_HEIGHT == 0) { DisplayMetrics dm = new DisplayMetrics(); dm = context.getResources().getDisplayMetrics(); SCREEN_HEIGHT = dm.heightPixels; } return SCREEN_HEIGHT; } }