Hi,

I have not found an example yet with a solution to the following task.

I have a SQLite database with two tables- BOOK and AUTHOR. I execute a
query on the DB that uses a join and results in a cursor that looks
like this:

_id   |   book     |   author
===================
0       book A      BOB
1       book B      BOB
2       book C      BOB
3       book D      DAVE
4       book N      JILL
5       book K      JILL

Now, I want to show this data in a ListView where each author has a
subheading row prior to listing their books:

===================
BOB ||||||||||||||||||||||||||||||||||||||||
===================
[ ] book A
[ ] book B
[ ] book C
===================
DAVE |||||||||||||||||||||||||||||||||||||
===================
[ ] book D
===================
JILL |||||||||||||||||||||||||||||||||||||||||
===================
[ ] book N
[ ] book K


New authors and books can be added to the database at any time, and I
also need the user to be able to remove books, hence the [ ]
checkboxes.

So i have two row layouts, row_author.xml & row_book.xml. I detect
when I need to show a row_author subheading by seeing when the current
author has changed compared to the previous row. But I have realised
that the rendering of an Author Row will then move the cursor forward
one row and jump over their first book.

Can anyone suggest a good approach to presenting data like this? Is
there a much better way to do this?

cheers
David

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