[Android] Move the ThumbnailerManager into the MainActivity

XilasZ xilasz at gmail.com
Sat Sep 29 11:29:17 CEST 2012


> Furthermore the ThumbnailerManager is now a singleton so it can be
> accessed indifferently from the MainActivity or the VideoListFragment.
>

I'm don't think bringing a singleton here is a good idea, Android can
decide to destroy the MainActivity or the VideoListFragment when they are
not displayed.
- Because the ThumbnailManager hold a reference to them, they won't be
garbage collected => memory leak
- when a new MainActivity/VideoListFragment will try to use
ThumbnailManager, ThumbnailManager will try to use an old invalid
MainActivity/VideoListFragment => it will surely crash

That's why i removed context singletons or singletons which holds contexts
back in frebruary (around 2012/02/18 & 2012/02/19).

see here :
http://android-developers.blogspot.fr/2009/01/avoiding-memory-leaks.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/android/attachments/20120929/031e237e/attachment.html>


More information about the Android mailing list