Request DISTINCT records from existing content providers in android

I want great posts from a content provider.

My current code is:

String[] projection= {"_id","address"}; Cursor address = getContentResolver().query(android.provider.Telephony.Sms.Inbox.CONTENT_URI,projection, null, null,"address ASC"); 
0
android android-contentprovider
Aug 27 '14 at 19:00
source share
2 answers

You can add the DISTINCT keyword to the column names in the projection. eg.

 String[] projection= {"DISTINCT _id"}; 

Hope this helps you.

-one
09 Sep '14 at 12:39 on
source share

// use DISTINCT before the column name

 String[] projection= { "DISTINCT _id", "DISTINCT address"}; Cursor address = getContentResolver().query(android.provider.Telephony.Sms.Inbox.CONTENT_URI,projection, null, null,"address ASC"); 
-one
Jun 15 '15 at 13:27
source share



All Articles