Juanvvc / ComicViewer

A simple comic viewer for Android. It has a gallery activity to show the cover of the available comics, bookmarking support and shows comic in CBR, CBZ and directories of JPG/PNG images. This is a test project to use in education, by no means is intended for final users but should be highly usable and stable. Source code is fully commented.
16 stars 9 forks source link

Old views are not deleted #6

Closed Juanvvc closed 12 years ago

Juanvvc commented 12 years ago

When the user changes a page, old views (for example, three pages past) are not unloaded/recycled until that the ImageSwitcher considers that it is necessary. This wastes memory and maybe created additional OutOfMemoryErrors.

Unload/recycle old views that are not going to be used any more. As an alternative, if you detect that the view is available (for example, the view of the last page is almost always available), do not load it again!

Juanvvc commented 12 years ago

Actually, the ImageSwitcher uses only two views: it is not possible for "the last three pages" to be in memory.

Instead of removing views, I overrided the methods in MyImageView that add a new drawable to recycle old drawables.