Android ListView Facepalm Clipart If you’re working with Android, chances are you’ve run in to issues with ListView, ExpandableListView or their parent, AbsListView. I’m not ashamed to admit spending more than a couple evenings staring angrily at misbehaving lists and adapters. It’s almost a right of passage for new Android devs.

The most frequently referenced question out of all Android tagged questions on StackOverflow is “How do I do a lazy load of images in ListView?”. Answering requires a non-trivial understanding of how these components and their adapters work along with a healthy dose of Android concurrency patterns. Poking around Stack Overflow, I found that of 380,906 Android tagged questions at the time of this posting, roughly 25,000 sport tags closely related to ListView, ExpandableListView or their Adapter partners roughly representing 5% of all Android tagged questions. In response, I’m kicking off a series of posts centered on ListView, ExpandableListView and their related Adapter partners. The basics and some much needed best practices are covered well2 and distributed broadly. Instead, I’m going to provide some working examples to reveal a few unexplored gotcha’s in ListView and the oft ignored ExpandableListView. Along the way, I’m going to slice open the source code reveal some of the least exposed innards of these components. There’s no better way to truly understand a framework than to dive in to the source. Enjoy!

[2] If you haven’t seen The World Of ListView video from GoogleIO 2010, watch it before you write another piece of code relating to a ListView or Adapter! I can’t recommend it enough.