联系人组名称变得非常奇怪
当查看 Google 通讯录或 HTC Legend 手机的人脉应用程序中的联系人组时,我得到的组名称正常,例如:朋友、家人、VIP、收藏夹等...
但在我的应用程序中,我得到了非常错误的名称,例如
“家庭”变为“系统组:家庭”
“好友”变为“系统组:好友”
“收藏夹”变成了“Favorite_5656100000000_3245664334564”
我使用下面的代码来读取这些值:
public Cursor getFromSystem() {
// Get the base URI for the People table in the Contacts content
// provider.
Uri contacts = ContactsContract.Groups.CONTENT_URI;
// Make the query.
ContentResolver cr = ctx.getContentResolver();
// Form an array specifying which columns to return.
String[] projection = new String[] {
ContactsContract.Groups._ID, ContactsContract.Groups.TITLE,
ContactsContract.Groups.NOTES
};
Cursor managedCursor = cr.query(contacts, projection, ContactsContract.Groups.DELETED
+ "=0", null, ContactsContract.Groups.TITLE + " COLLATE LOCALIZED ASC");
return managedCursor;
}
我缺少什么?
When looking at the Contact Groups on Google Contacts or in the People application of my HTC Legend phone, I get the groups names ok eg: Friends, Family, VIP, Favorite etc...
But in my application I get really wrong names such as
"Family" became "System Group: Family"
"Friends" became "System Group: Friends"
"Favorite" became "Favorite_5656100000000_3245664334564"
I use the below code to read these values:
public Cursor getFromSystem() {
// Get the base URI for the People table in the Contacts content
// provider.
Uri contacts = ContactsContract.Groups.CONTENT_URI;
// Make the query.
ContentResolver cr = ctx.getContentResolver();
// Form an array specifying which columns to return.
String[] projection = new String[] {
ContactsContract.Groups._ID, ContactsContract.Groups.TITLE,
ContactsContract.Groups.NOTES
};
Cursor managedCursor = cr.query(contacts, projection, ContactsContract.Groups.DELETED
+ "=0", null, ContactsContract.Groups.TITLE + " COLLATE LOCALIZED ASC");
return managedCursor;
}
What I am missing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这听起来像是一个错误。我的一部测试手机具有正确/经过清理的标题,而另一部则具有此类不正确的标题。我会此处提交此文件。
我还直接检查了
contacts2.db
数据库,发现SYSTEM_ID
列似乎已被清理 - 但这可能不安全用于显示目的。That sounds like a bug. One of my test phones has correct/sanitized titles, while the other has that type of incorrect title. I'd file this here.
I also inspected the
contacts2.db
database directly, and found that theSYSTEM_ID
column seems to be sanitized – but that's probably not safe to use for display purposes.