Using CursorLoader to get emails causes duplication of emails

前端 未结 6 2232
野趣味
野趣味 2021-02-14 07:17

I am trying to get email ids of uses contacts. For that I am using Cursor Loader. There is one problem I am getting duplicate email ids also. How to remove email duplicacy. Shou

6条回答
  •  情话喂你
    2021-02-14 07:41

    I found a solution Use DISTINCT keyword in selection Array.

    String[] projection = new String[] { ContactsContract.Contacts._ID, ContactsContract.Contacts.DISPLAY_NAME, "DISTINCT" + ContactsContract.CommonDataKinds.Email.DATA};
    

提交回复
热议问题