Android examples for User Interface:Screen Position
get Center Screen Position
//package com.java2s; import android.content.Context; import android.graphics.Point; import android.view.Display; import android.view.WindowManager; public class Main { public static Point getCenterScreenPosition(Context context) { Point p = getScreenSize(context); p.x = p.x / 2;//from w w w . j a v a 2s . c o m p.y = p.y / 2; return p; } public static Point getScreenSize(Context context) { Display display = ((WindowManager) context .getSystemService(Context.WINDOW_SERVICE)) .getDefaultDisplay(); Point size = new Point(); display.getSize(size); return size; } }