bryon
bryon

Reputation: 275

Android List with section headers

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

Upvotes: 12

Views: 16128

Answers (3)

CommonsWare
CommonsWare

Reputation: 1006769

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.

Upvotes: 12

gMale
gMale

Reputation: 17895

We have this same problem and have found the following two projects that meet our needs:

Upvotes: 2

Dominic
Dominic

Reputation: 3473

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

Upvotes: 4

Related Questions