Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android List with section headers

Tags:

android

I'm trying to create a list with headers above a grouping of items. I was looking at SeperatedListAdapter available here: http://jsharkey.org/blog/2008/08/18/separating-lists-with-headers-in-android-09/ but I ran into an error (ERROR/AndroidRuntime(2025):

java.lang.IllegalStateException: ArrayAdapter requires the resource ID to be a TextView
) 

Now I'm looking into more options including making a new one. Do you guys have any hints?

Thanks, Bryon

like image 371
bryon Avatar asked Apr 23 '10 22:04

bryon


2 Answers

AFAIK, Mr. Sharkey's code works just fine. You may be using the wrong ArrayAdapter constructor.

You can also use my MergeAdapter to achieve the same ends.

like image 145
CommonsWare Avatar answered Sep 24 '22 02:09

CommonsWare


That's how I solved the sectioning in ListViews with an ArrayAdapter http://bartinger.at/listview-with-sectionsseparators/

like image 34
Dominic Avatar answered Sep 22 '22 02:09

Dominic