Search code examples
androidandroid-cursorloader

Get the cursor associated with the contact table whose image is not filled


I am trying to get a cursor containing the names of contacts that do not have an birthday in Android (in ContactsContract.CommonDataKinds.Event.START_DATE with ContactsContract.CommonDataKinds.Event.TYPE = ContactsContract.CommonDataKinds.Event.TYPE_BIRTHDAY)

I go through a CursorLoader for a display on my listview. But I do not really know what condition indicated for the selection in

new CursorLoader(
                getActivity(),
                ContactsContract.Data.CONTENT_URI,
                {
                  ContactsContract.Contacts._ID,
                  ContactsContract.Contacts.LOOKUP_KEY,
                  ContactsContract.Contacts.DISPLAY_NAME_PRIMARY
                },
                ???,
                null,
                null);

Can you help me ?


Solution

  • I found a solution but that does not pass through a selection of query. Because the ContentProvider of the Contacts is not explicitly linked to birthdays (this is why we go through a CommonDataKinds)

    I have bypassed the problem by doing a filter on the retrieve object in the cursor. So of course it's less optimized than if it was a query condition but it works.