Search code examples
androidperformanceandroid-listviewandroid-arrayadapter

Are there any optimized ways to render large lists in android?


I'm parsing an XML file, and extract it to an array with 504 length. Each item in array contains three fields of short String.

The problem occurs when I'm trying to populate the list with array content. Log Cat shows logs like this many times:

WAIT_FOR_CONCURRENT_GC blocked 9ms

GC_CONCURRENT freed 202K, 8% free 10694K/11527K, paused 12ms+13ms, total 52ms

As I searched, it means that a lot of objects are being created and they need a lot of memory

I reviewed my code and got to the conclusion that this happens in time of creating list. In consequence the performance is too low to use the app on a real device that has 1024MB RAM.

Are there any optimized ways to render large lists in android?

Does this improve the performance, If I extract xml to Database, then make the list?


Solution

  • The best solution would be to reimplement the the ArrayAdapter, there is already a similar question here. Edit: This video from Google I/O 2010 it will give you an idea on how ListViews work.