How to make Android not to recycle my Bitmap until I don't need it?

Posted by RankoR on Stack Overflow See other posts from Stack Overflow or by RankoR
Published on 2012-06-12T22:02:40Z Indexed on 2012/06/12 22:40 UTC
Read the original article Hit count: 239

I'm getting drawing cache of the view, that is set as contentView to the Activity. Then I set new content view to the activity and pass that drawing cache to it. But Android recycles my bitmaps and I'm getting this exception:

06-13 01:58:04.132: E/AndroidRuntime(15106): java.lang.RuntimeException: Canvas: trying to use a recycled bitmap android.graphics.Bitmap@40e72dd8

Any way to fix it? I had an idea to extend Bitmap class, but it's final. Why GC is recycling it?

© Stack Overflow or respective owner

Related posts about android

Related posts about bitmap