bitmap1 = bitmap2导致bitmap1不能使用一致报回收错误解决

public Bitmap createCanNotRecycleBitmap(Bitmap bitmap) {
int fgWidth = bitmap.getWidth();
int fgHeight = bitmap.getHeight();
//create the new blank bitmap 创建一个新的和SRC长度宽度一样的位图
Bitmap newbmp = Bitmap.createBitmap(fgWidth, fgHeight, Bitmap.Config.ARGB_8888);
Canvas cv = new Canvas(newbmp);

//draw fg into
cv.drawBitmap(bitmap, new Rect(0,0,fgWidth,fgHeight), new Rect(0,0,fgWidth,fgHeight), null);//在 0,0坐标开始画入fg ,可以从任意位置画入
//save all clip
cv.save(Canvas.ALL_SAVE_FLAG);//保存
//store
cv.restore();//存储
return newbmp;
}
原文地址:https://www.cnblogs.com/visuals/p/4953914.html