Display the Contacts in sorting order ContactsContract.Contacts of Content Resolver
android, android-contentresolver
Solution
To sort result according to name use `Phone.DISPLAY_NAME` constant with `ASC` as last parameter to `query` method. do it as:
Cursor pCur = cr.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
null,
ContactsContract.CommonDataKinds.Phone.CONTACT_ID+ " = ?",
new String[] { id },
ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME+" ASC");
Problem
My intention is to display the contacts in sorting order using `content resolver` in android. For that I'm writing: ``` Cursor pCur = cr.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, ContactsContract.CommonDataKinds.Phone.CONTACT_ID+ " = ?", new String[] { id }, null); ``` It needs that the last parameter in query method should not be null for sorting the elements by `Name`. Which part of code I have to replace the null parameter to achieve sorting by name?