开发者

Getting the DISTINCT most recently contacted contacts from Call Log

开发者 https://www.devze.com 2023-02-13 18:01 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消