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

有帮助吗?

解决方案

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/

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top