Java tutorial
//package com.java2s; import android.app.Activity; import android.graphics.Point; import android.os.Build; import android.view.Display; public class Main { public static Point getRealScreenSize(Activity activity) { Point result = new Point(); Display display = activity.getWindowManager().getDefaultDisplay(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { display.getRealSize(result); } else { display.getSize(result); } return result; } }