> 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?
That's going to be a bit icky. I have a set of adapters in my CWAC projects (http://commonsware.com/cwac) that implement patterns of modifying existing adapters. You may be able to use similar techniques here. Basically, you need an Adapter that is aware of your header/content business rules. For example, getCount() needs to return the right number of rows -- the sum of your total # of books and your total # of author headers. I have tended to do this via the decorator pattern, creating a wrapping Adapter that handles all of the conversions. For example, I have a MergeAdapter that stitches together Views and other Adapters into a single contiguous whole. So, I'm fairly certain it is possible to create an Adapter that implements your desired features, but it may be several dozen lines of code. -- Mark Murphy (a Commons Guy) http://commonsware.com Android App Developer Books: http://commonsware.com/books.html -- 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

