Android : 联系人列表不是所有字母的大小写
Android : Contact List is not by all case of Letters
我正在尝试按排序顺序获取所有 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();
}
此处名称作为单独的两个列表进行排序。首先对所有以大写开头的名称进行排序,然后对以小写开头的名称进行排序。
谁能告诉我如何解决这个问题?
提前致谢:)
将这样的查询与整理一起使用。
Cursor cursor = cr.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, PROJECTION,
null, null, ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME + " COLLATE NOCASE ASC");
我正在尝试按排序顺序获取所有 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();
}
此处名称作为单独的两个列表进行排序。首先对所有以大写开头的名称进行排序,然后对以小写开头的名称进行排序。
谁能告诉我如何解决这个问题?
提前致谢:)
将这样的查询与整理一起使用。
Cursor cursor = cr.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, PROJECTION,
null, null, ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME + " COLLATE NOCASE ASC");