Eugene S
Eugene S

Reputation: 3122

cwac-merge: is this possible with MergeAdapter?

I'm trying to solve the following problem, and I'm wondering if the MergeAdapter can solve it for me.

I have a ListView displaying rows of chats, 1 list item per chat subject. Within a given row I also want to display the list of users that are participating in the chat. I want a single list row to look like the following:

+--------------------------------------+
| This is a subject              Sep 2 |
| user1, user2, user3                  |
+--------------------------------------+

The list of chats is in a database table, but the list of users associated with a given chat are in a separate database table (normalized schema).

Here's a simplified schema that I'm using:

chats        chatUsers    users
-----        ---------    -----
chatId ----> chatId       name
date         userId ----> userId
subject

Would the MergeAdapter allow me to visually combine the results of the two queries into a single list item view, where:

Query 1: returns the list of chats in time order

Query 2: returns the list of users that are part of each chat

Thanks!

Upvotes: 0

Views: 284

Answers (1)

CommonsWare
CommonsWare

Reputation: 1006869

No. MergeAdapter handles Adapter concatentation, taking adapters representing smaller queries and appending them to behave as if they were one large contiguous adapter.

Upvotes: 1

Related Questions