Java tutorial
//package com.java2s; import android.app.Activity; import android.graphics.Rect; public class Main { public static int[] getApplicationWidthAndHeight(Activity activity) { Rect outRect = new Rect(); activity.getWindow().getDecorView().getWindowVisibleDisplayFrame(outRect); System.out.println("top:" + outRect.top + " ; left: " + outRect.left); int info[] = new int[2]; info[0] = outRect.width(); info[1] = outRect.height(); return info; } }