androiduriandroid-2.2-froyocontactscontract

Android 2.2; Can you query from 2 different URIs at the same time?


If you want to obtain contacts data from two separate URIs, can you do this in a single query?

For example :

    ContentResolver cr;
    Cursor emailCur = cr.query( 
            ContactsContract.CommonDataKinds.Email.CONTENT_URI, 
            null,
            null, 
                    null); 

Should return all available columns against the CommonDataKinds.Email URI

What if I want to return all entries from both the Email AND Phone kind?

Would I need to create two separate queries, and concatenate the results?


Solution

  • You can do it with a single query if you use ContactsContract.CommonDataKinds.Data.CONTENT_URI and provide a selection for the Email and Phone mime types.