Java tutorial
//package com.java2s; //License from project: Apache License import android.annotation.TargetApi; import android.graphics.Point; import android.os.Build; import android.support.annotation.NonNull; import android.view.Display; public class Main { @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2) public static int getDisplayWidthPixel13AndLater(@NonNull Display display) { Point size = new Point(); display.getSize(size); return size.x; } }