Android "trying To Use Recycled Bitmap" Error?
Solution 1:
You don't actually need to call recycle method here. Refresh button should just clear the array, garbage collector will free the memory later. If you get OutOfMemory it means some other objects are still referencing your old images and Garbage Collector can't remove them.
I may asume that some ImageViews display your bitmaps and they keep references to that bitmaps. You can't remove old bitmaps while they're still displayed. So a possible solution is to clear ImageVIews too. After that you can clear the array and fill it with new images.
Recycle frees the memory but some ImageView is still displaying the bitmap and it can't do that after recycle, that's why you get "Trying to use recycled bitmap".
These all are just an assumptions because I can't see your complete code.
Solution 2:
If the memory is very large, you'd better recycle the bitmap yourself. GC can't be controled.
Post a Comment for "Android "trying To Use Recycled Bitmap" Error?"