tags:

views:

269

answers:

1

Hi, 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

+1  A: 

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. Here is a sample project that demonstrates using a MergeAdapter for headers.

CommonsWare
Yes, shortly after posting I got it to work with a new application, I must have had some sort of conflict. The linked resource is very helpful, thank you for that.
bryon
Would you recommend Mr. Sharkey's code or are there maybe more robust / performant / native / easier possibilities? He made that list in 2008 with API 0.9, maybe there are better options now?
OneWorld
@OneWorld: The only real issue with Mr. Sharkey's code is the GPL license, if that would be an issue for you. The performance of his adapter or my adapter are similar, though the performance issues would tend to lie elsewhere (e.g., in your getting the stuff together in a form that works either adapter). And, both are meant to demonstrate general techniques that could be applied to a custom adapter of your own devising.
CommonsWare