Obtaining Android Contacts Sorting Preference

2020-05-08 07:28发布

问题:

Inside "Contacts" -> "Settings" in android, we have "Sort list by" and "view contact name as" options. Is there any way of obtaining these preferences inside another app? Meaning my app has my own version of a contact list. I need these in order to sort it accordingly.

回答1:

    int sort_order = 
Settings.System.getInt(getContentResolver(),ContactsContract.Preferences.SORT_ORDER);
    inr display_order =
Settings.System.getInt(getContentResolver(),ContactsContract.Preferences.DISPLAY_ORDER);