0

This may be a very specific question so I'm asking here. Also, I read this question but this does not apply in my case.

Shortly, I'm trying to join two content:// tables and then I should pass the result to a CursorLoader.

I've tried to write a rough selection clause as

Uri frequent_contact = ContactsContract.Contacts.CONTENT_STREQUENT_URI;
Uri all_contacts = ContactsContract.Contacts.CONTENT_URI;
String selection = "'" + frequent_contact + "._id' = '" + all_contacts + "._id'";

or

String selection = frequent_contact + "._id = " + all_contacts + "._id";

Because the _id value is an int but it is saved as a String.

Then I return new CursorLoader(context, all_contacts, null, selection, null, null);

In the first case the app runs but the adapter is not filled, in the second case the app crash.

So, is it possible to join two content:// table? And if yes, how?

Thank you in advance.

Community
  • 1
  • 1
Lampione
  • 1,622
  • 3
  • 21
  • 39
  • No, it is not possible... ContentProvider is a different abstraction level ... do not think about CP as a database(well, mostly it is implemented with sqlite but can be any implementation - fx direct REST api) ... but there is a CursorJoiner in android api – Selvin Sep 07 '15 at 09:21
  • @Selvin thank you, I'll have a look at that CursorJoiner. – Lampione Sep 07 '15 at 09:31

0 Answers0