Java tutorial
//package com.java2s; import android.content.Context; import android.util.DisplayMetrics; import android.view.WindowManager; public class Main { /** * Get the screen height. * * @param context * @return the screen height */ public static int getScreenHeight(Context context) { if (context != null) { DisplayMetrics displayMetrics = new DisplayMetrics(); WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); windowManager.getDefaultDisplay().getMetrics(displayMetrics); return displayMetrics.heightPixels; } else { return 1920; } } }