【发布时间】:2015-12-08 05:55:40
【问题描述】:
我正在尝试按排序顺序获取所有 Contact 列表。我正在获取所有联系人列表,但它的第一个排序名称以 大写(ABCD..) 开头,在对所有名称以大写字母开头进行排序后,只有它开始排序以开头的剩余名称小写字母(a,b,c....)
private static final String[] PROJECTION = new String[] {
ContactsContract.CommonDataKinds.Phone.CONTACT_ID,
ContactsContract.Contacts.DISPLAY_NAME,
ContactsContract.CommonDataKinds.Phone.NUMBER
};
ContentResolver cr = getContentResolver();
Cursor cursor = cr.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, PROJECTION,
null, null, ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME + " ASC");
if (cursor != null) {
try {
final int nameIndex =
cursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME);
nameContact = cursor.getString(nameIndex);
finally {
cursor.close();
}
这里的名称是作为一个单独的两个列表排序的。首先排序所有名称以大写开头,然后排序名称以小写开头。
谁能告诉我如何解决这个问题?
提前致谢:)
【问题讨论】:
标签: android android-contentprovider android-contacts android-contentresolver