Java tutorial
//package com.java2s; import android.app.Activity; import android.util.DisplayMetrics; public class Main { public static int[] getScreenWH(Activity activity) { int[] WH = { 0, 0 }; DisplayMetrics metrics = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(metrics); WH[0] = metrics.widthPixels; WH[1] = metrics.heightPixels; return WH; } }