Java tutorial
//package com.java2s; import android.app.Activity; import android.view.WindowManager; public class Main { @SuppressWarnings("deprecation") private static int[] getScreenParams(Activity mContext) { WindowManager wm = mContext.getWindowManager(); int width = wm.getDefaultDisplay().getWidth(); int height = wm.getDefaultDisplay().getHeight(); return new int[] { width, height }; } }