Java tutorial
//package com.java2s; import android.annotation.TargetApi; import android.app.Activity; import android.graphics.Point; import android.os.Build; public class Main { @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2) public static void init2(Activity activity) { Point point = new Point(); activity.getWindowManager().getDefaultDisplay().getSize(point); } }