From the Android documentation, I gather that I can append the ContactsContract.Contacts.Data.CONTENT_DIRECTORY string to ContactsContract.Contacts.CONTENT_URI and be able to access both Contact's fields and Data's fields. Unfortunately I am getting an exception with this code
Cursor cursor = context.getContentResolver().query(
Uri.withAppendedPath(Contacts.CONTENT_URI, Contacts.Data.CONTENT_DIRECTORY),
null, null, null, null);
The exception I get is:
java.lang.IllegalArgumentException: URI: content://com.android.contacts/contacts/data, calling user: ...
What am I doing wrong? Note: I am using Android 2.1