Android Arrayadapter & Listview Slowness
Solution 1:
You can store your Bitmaps in a LRU (Least Recently Used) cache based on SoftReferences.
That kind of cache keeps your most used objects in memory, and when the systems comes out of memory the usage of SoftReference allow the GarbageCollector to free these resources.
Here is an implementation I am currently using in my app EmailAlbum: http://code.google.com/p/emailalbum/source/browse/EmailAlbumAndroid/tags/REL-2_9_3/src/com/kg/emailalbum/mobile/util/NewLRUCache.java
This was taken from this French post about java cache implementations, I just renamed a few methods to allow switching from Hashmap to this cache without having to modify method calls.
Then, you will certainly want to avoid the UI from slowing down each time a picture is beeing read from SDCard (or the web). That's when you will have to look to AsyncTask which allows to loa pictures in a background Thread while letting the user interact with the UI (like scroll faster even when pictures are beeing loaded).
Post a Comment for "Android Arrayadapter & Listview Slowness"