I read a lot about memory leaks in the last few days, and came across some interesting stuff. I saw this answer to a basic Android bitmap-related memory leak question (the answer is from 2011) and I was wondering if this is still the case. If I'm using views that contain bitmaps in my activity (ImageViews, TextViews...), do I really need to unbind their drawables when destroying the activity? Is this only in some cases or always?
Asked
Active
Viewed 611 times
1 Answers
2
It's no longer necessary as of 4.0, as the callback is now stored in a WeakReference
.
public final void setCallback(Callback cb) {
mCallback = cb;
}
and in 4.0.1:
public final void setCallback(Callback cb) {
mCallback = new WeakReference<Callback>(cb);
}

Kevin Coppock
- 133,643
- 45
- 263
- 274