Java tutorial
//package com.java2s; import android.graphics.Bitmap; import android.graphics.Matrix; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; public class Main { public static Drawable scaleImage(Drawable paramDrawable, float paramFloat1, float paramFloat2) { BitmapDrawable localBitmapDrawable = null; if (paramDrawable != null) { Bitmap localBitmap = ((BitmapDrawable) paramDrawable).getBitmap(); int i = localBitmap.getWidth(); int j = localBitmap.getHeight(); Matrix localMatrix = new Matrix(); localMatrix.postScale(paramFloat1, paramFloat2); localBitmapDrawable = new BitmapDrawable( Bitmap.createBitmap(localBitmap, 0, 0, i, j, localMatrix, true)); } return localBitmapDrawable; } }