Java tutorial
//package com.java2s; //License from project: Open Source License import android.content.Context; import android.graphics.Point; import android.view.Display; import android.view.WindowManager; public class Main { private static int mScreenWidth = 0; private static int mScreenHeight = 0; private static void getScreenMetric(Context cxt) { WindowManager wm = (WindowManager) cxt.getSystemService(Context.WINDOW_SERVICE); Display display = wm.getDefaultDisplay(); Point size = new Point(); display.getSize(size); mScreenWidth = size.x; mScreenHeight = size.y; } }