android - How to avoid duplicate values from the contacts database while usingContactsContract.CommonDataKinds.Phone.CONTENT_URI? -


i using following query fetch list of contacts.

@override public loader<cursor> oncreateloader(int id, bundle args) {     string selection = string.format("%s =\'1\' , length(\"%s, \") > 0",             contactscontract.contacts.has_phone_number,             contactscontract.contacts.display_name_primary);      return new cursorloader(context,             contactscontract.commondatakinds.phone.content_uri, // uri             contactprofile.contact_projection, // projection fields             selection, // selection criteria             null, // selection args             contactscontract.commondatakinds.phone.display_name_primary                     + " collate nocase asc" // case insensitive sort order     ); } 

but getting duplicate values on phone multiple accounts. how avoid duplicate values

you cannot use "distinct" when query using cursorloader. pass account param query selection, or remove duplicates when use returned cursor.


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -