I would like to display a list of contacts.
I would like to pull those contacts from Android's contacts ContentProvider
(as defined by ContactsContract
) as well as a table of contacts managed by my own app (for which I've also defined a ContentProvider
).
Ideally I would like to produce a single Cursor
that represents a union of queries from both sources.
If I had full access to Android's contacts table, I would use a SQL UNION. As it is, I believe that that is impossible/bad practice to perform a raw SQL query on a database that doesn't belong to your own app.
Alternatively, is there a straight forward way to define a CursorWrapper
extension which would iterate over one cursor before moving onto the next?
I would accept any means of ending up with a single Cursor
object for these two sources or an elegant outline for an implementation of an Adapter
which would deliver the same result.