Java tutorial
//package com.java2s; import android.graphics.*; public class Main { public static Bitmap scaleToFill(Bitmap bitmap, int i, int j) { float f = (float) j / (float) bitmap.getWidth(); float f1 = (float) i / (float) bitmap.getWidth(); float f2; if (f > f1) { f2 = f1; } else { f2 = f; } return Bitmap.createScaledBitmap(bitmap, (int) (f2 * (float) bitmap.getWidth()), (int) (f2 * (float) bitmap.getHeight()), false); } }