>> Actually inserting the headers as a second viewtype requires you to
>> scan the whole result to get an accurate count.
>>
>> The best I've come up with is returning the Header combined with the
>> first item as a single view so as to keep the count correct, but then
>> selection looks wrong.
>>
>> Any tips?

Step #1: Run a query to get you your count of headers (SELECT
COUNT(DISTINCT artist) FROM thatfunkymusic WHERE...)

Step #2: Run your current query and pour it into your existing CursorAdapter

Step #3: Create a custom Adapter that wraps around your existing
CursorAdapter (see CWAC-Adapter). This adapter will need to return the
correct count, adjust all references to positions to take the headers
into account, return the proper number of view types, return the
headers for the proper positions, and all that jazz.

http://github.com/commonsguy/cwac-adapter

In other words, it is doable without a bunch of individual queries,
but it is not terribly straight-forward. I have added this to my
running list of "reusable components to write someday", but if
somebody beats me to it, that'd be absolutely delightful.

-- 
Mark Murphy
CommonsWare
[email protected]
http://commonsware.com

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to