Reputation: 4513
I've got a ListView with a custom adapter that extends an ArrayAdapter. Each item in the ListView is an ImageView.
The ListView is a menu that is mostly hidden, but is loaded on startup - it takes a HUDE amount of memory.
I'd like it to populate only when it is shown, and to be released when it is hidden (which will hinder performance, but release memory I guess).
How can this be done? Any other ideas to make ListView use the memory better?
Thanks
Upvotes: 0
Views: 1864
Reputation: 1138
As @Raghunandan said about ViewHolder
, you should implement the same. That will save from creating uncessary objects and will make your ListView
scrolling smooth.
Here is a link which will give you performance tips for your ListView
http://lucasr.org/2012/04/05/performance-tips-for-androids-listview/
Upvotes: 2