I am creating a messaging application in android and i want to get text messages from unique contact numbers only.
I tried following code but it is not working.
String[] projection = new String[] { "_id","DISTINCT "+ContactsContract.PhoneLookup.NUMBER, "person", "body", "date", "type" };
Cursor cursor = getContentResolver().query(uri, projection,null, null, null);
It throwing error here.
Caused by: android.database.sqlite.SQLiteException: near "DISTINCT": syntax error: , while compiling: SELECT _id, DISTINCT number, person, body, date, type FROM sms ORDER BY date DESC
Can Some one please crack this out for me.
Aucun commentaire:
Enregistrer un commentaire