Java tutorial
//package com.java2s; //License from project: Apache License import android.app.Activity; import android.graphics.Point; import android.os.Build; import android.view.Display; public class Main { public static Point getDisplaySize(Activity context) { Display display = context.getWindowManager().getDefaultDisplay(); final Point point = new Point(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { display.getSize(point); } else { point.x = display.getWidth(); point.y = display.getHeight(); } return point; } }