Android examples for User Interface:Screen Resolution
get Screen Rect
//package com.java2s; import android.content.Context; import android.graphics.Rect; import android.view.Display; import android.view.WindowManager; public class Main { public static Rect getScreenRect(Context context) { Display display = ((WindowManager) context .getSystemService(Context.WINDOW_SERVICE)) .getDefaultDisplay();// w ww. ja va2 s.co m int w = display.getWidth(); int h = display.getHeight(); return new Rect(0, 0, w, h); } }