Java tutorial
//package com.java2s; import android.graphics.Point; import android.view.Display; public class Main { public static Point getWindowSize(Display defaultDisplay) { Point windowSize = new Point(); if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB_MR2) { defaultDisplay.getSize(windowSize); } else { windowSize.x = defaultDisplay.getWidth(); windowSize.y = defaultDisplay.getHeight(); } return windowSize; } }