Getting the DISTINCT most recently contacted contacts from Call Log
Since it is not possible to use DISTINCT whil开发者_C百科e querying the CallLog.Calls.CONTENT_URI, what can be a good workaround for getting the distinct most recently contacted contacts from the call logs?
It wouldn't be a GET distinct, but if you got them then stored them into a Set, say a TreeSet you'd be left with a distinct list.
HTH
Cursor cursor = getActivity().getContentResolver().query(ContactsContract.Contacts.CONTENT_URI, null, "TIMES_CONTACTED>0", null, "CONTACT_LAST_UPDATED_TIMESTAMP DESC");
Use this cursor query.I am assuming that you have used Hash Set to remove duplicate contacts.
精彩评论