I\'m trying to save a Layout into an Image in the SDCard but I get this error. I tried several codes I found in this forum but all of them have the same compress call that is gi
The solution is: you only need to copy the bitmap.
imageneViewer.setImageBitmap(lienzo.getDrawingCache().copy(Bitmap.Config.RGB_565, false));
This is probably causing the bitmap to be recycled:
v.setDrawingCacheEnabled(false); // clear drawing cache
If you want the bitmap to hang around longer, then you should copy it.
This resolved my issues.
View drawingView = get_your_view_for_render;
drawingView.buildDrawingCache(true);
Bitmap bitmap = drawingView.getDrawingCache(true).copy(Config.RGB_565, false);
drawingView.destroyDrawingCache();
// bitmap is now OK for you to use without recycling errors.