Hello all, I have two tables I want to (inner) join, Contacts.People and Contacts.ContactMethods. The result will be displayed in a ListActivity. After looking into this, it appears that I should use CursorJoiner. So the code would look something like this:
// 1) prepare cursors Cursor peopleCursor = contentResolver.query( Contacts.People.CONTENT_URI, new String[] {Contacts.People._ID, Contacts.People.DISPLAY_NAME}, null, null, Contacts.People._ID); Cursor cmCursor = contentResolver.query( Contacts.ContactMethods.CONTENT_URI, new String[] {Contacts.ContactMethods.PERSON_ID, Contacts.ContactMethods.DATA}, "label=\"secret identity\"", null, Contacts.ContactMethods.PERSON_ID); // 2) join them CursorJoiner joiner = new CursorJoiner( peopleCursor, new String[] {Contacts.People._ID}, cmCursor, new String[] {Contacts.ContactMethods.PERSON_ID}); for (CursorJointer.Result joinerResult : joiner) { switch (joinerResult) { case BOTH: // handle case where a row with the same key is in both cursors // I think I'm supposed to do something here break; } } // 3) Make a list adapter from a cursor So my question is, how to I make a new cursor from the first two? Thanks in advance. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---