Android examples for Phone:Screen
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) { if (context == null) { return new Rect(0, 0, 0, 0); }// w w w . jav a 2 s . c o m Display display = ((WindowManager) context .getSystemService(Context.WINDOW_SERVICE)) .getDefaultDisplay(); int w = display.getWidth(); int h = display.getHeight(); return new Rect(0, 0, w, h); } }