Using CursorLoader to get emails causes duplication of emails

前端 未结 6 2221
攒了一身酷
攒了一身酷 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:41

    You can put setDistinct in your content provider.

        @Override 
    public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
        ...
        final SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
        qb.setDistinct(true);
    

提交回复
热议问题