Java tutorial
//package com.java2s; import android.content.Context; import android.graphics.Point; import android.view.Display; import android.view.WindowManager; public class Main { private static Point screenSize; public static Point getScreenSize(Context context) { if (screenSize != null) { return screenSize; } int pxWidth; int pxHeight; Display display = ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay(); pxWidth = display.getWidth(); pxHeight = display.getHeight(); screenSize = new Point(pxWidth, pxHeight); return screenSize; } }