Java tutorial
//package com.java2s; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Rect; public class Main { public static Bitmap mergeBitmap(Bitmap oriBmp, Bitmap subBmp, final Rect oriRect, final Rect subRect) { if (subBmp == null) { return oriBmp; } if (oriBmp == null) { return null; } if (!oriBmp.isMutable()) { oriBmp = createMutableBitmap(oriBmp); } Canvas canvas = new Canvas(oriBmp); canvas.drawBitmap(subBmp, subRect, oriRect, null); return oriBmp; } public static Bitmap mergeBitmap(Bitmap oriBmp, Bitmap subBmp) { if (subBmp == null) { return oriBmp; } if (oriBmp == null) { return null; } return mergeBitmap(oriBmp, subBmp, new Rect(0, 0, oriBmp.getWidth(), oriBmp.getHeight()), new Rect(0, 0, subBmp.getWidth(), subBmp.getHeight())); } public static Bitmap createMutableBitmap(Bitmap src) { Bitmap result = null; if (src == null) { return null; } result = src.copy(Bitmap.Config.ARGB_8888, true); return result; } }