Android: sorting a combined cursor

I am wondering if there is a way to combine the two cursors together and then resort to them.

I can easily combine the two cursors together using MergedCursor, but that does not sort them.

I have two sets of contacts in two separate cursors (with completely different schemes), and I want to combine them and sort them by name (the name column is different in the two cursors).

Is it possible?

+3
source share
3 answers

Perhaps you'd better create an SQL query that returns a cursor that contains all the data you want to view than create two different queries and try to combine them when you have a cursor?

+1

As a long, perhaps not very effective solution, you can use this combined cursor to create another database and sort from this query. Otherwise, can you periodically add items from the local contacts of the phone to your database or something like that?

0
source

Source: https://habr.com/ru/post/1757391/


All Articles