Using CursorLoader to get emails causes duplication of emails

前端 未结 6 2195
攒了一身酷
攒了一身酷 2021-02-14 06:44

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:37

    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};
    

提交回复
热议问题