My activity A has a variable b, which has reference to a list of Bitmaps:
A.b.bitmaps = new ArrayList<Bitmap>();
The list is populated by my app, and the last Bitmap in the list is shown on an ImageView on the activity:
imgView.setImageBitmap(lastBitmap);
Then I start an activity of another app for social sharing, but when sharing is done, and my activity returns to the foreground, my app crashes.
java.lang.RuntimeException: Canvas: trying to use a recycled bitmap android.graphics.Bitmap@15c6d7b
at ...
The bitmap is lastBitmap. I guess it is somehow released and crashes the app when used to draw the imageView.
Why is it recycled when both the imageView and my instance variable have strong references to the Bitmap?
from Why is the Bitmap recycled after activity returns to foreground?
No comments:
Post a Comment