Using CursorLoader to get emails causes duplication of emails

前端 未结 6 2252
野趣味
野趣味 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:26

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

提交回复
热议问题