Java tutorial
//package com.java2s; import android.graphics.Point; import android.view.Display; import android.view.WindowManager; public class Main { public static int calculateImageSize(WindowManager window, int divider) { Display display = window.getDefaultDisplay(); Point resolution = new Point(); display.getSize(resolution); int width = resolution.x / divider; int height = resolution.y / divider; return Math.min(width, height); } }