Here you can find the source of zoomImage(Bitmap bgimage, int newWidth, int newHeight)
public static Bitmap zoomImage(Bitmap bgimage, int newWidth, int newHeight)
//package com.java2s; import android.graphics.Bitmap; import android.graphics.Matrix; public class Main { public static Bitmap zoomImage(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);//from w w w .j av a2 s .c o m return bitmap; } }