Here you can find the source of createFitXYBitmap(Bitmap srcBitmap, int dstWidth, int dstHeight, boolean tryRecycleSource)
public static Bitmap createFitXYBitmap(Bitmap srcBitmap, int dstWidth, int dstHeight, boolean tryRecycleSource)
//package com.java2s; import android.graphics.Bitmap; public class Main { public static Bitmap createFitXYBitmap(Bitmap srcBitmap, int dstWidth, int dstHeight, boolean tryRecycleSource) { if (srcBitmap == null || dstWidth <= 0 || dstHeight <= 0) { return srcBitmap; }/*from w w w . j ava 2 s. c o m*/ Bitmap dstBitmap = srcBitmap; try { dstBitmap = Bitmap.createScaledBitmap(srcBitmap, dstWidth, dstHeight, true); if (dstBitmap != srcBitmap && tryRecycleSource) { srcBitmap.recycle(); } } catch (Throwable e) { e.printStackTrace(); } return dstBitmap; } }