Here you can find the source of zoomBitmap(Bitmap bgimage, int newWidth, int newHeight)
public static Bitmap zoomBitmap(Bitmap bgimage, int newWidth, int newHeight)
//package com.java2s; import android.graphics.Bitmap; import android.graphics.Matrix; public class Main { public static Bitmap zoomBitmap(Bitmap bgimage, int newWidth, int newHeight) { int width = bgimage.getWidth(); int height = bgimage.getHeight(); Matrix matrix = new Matrix(); float scaleWidth = ((float) newWidth) / width; float scaleHeight = ((float) newHeight) / height; matrix.postScale(scaleWidth, scaleHeight); Bitmap bitmap = Bitmap.createBitmap(bgimage, 0, 0, width, height, matrix, true);//w w w. j av a 2s. co m return bitmap; } }