联系人组名称变得非常奇怪

发布于 2024-08-31 11:02:02 字数 1047 浏览 6 评论 0原文

当查看 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

左秋 2024-09-07 11:02:02

这听起来像是一个错误。我的一部测试手机具有正确/经过清理的标题,而另一部则具有此类不正确的标题。我会此处提交此文件。

我还直接检查了 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 the SYSTEM_ID column seems to be sanitized – but that's probably not safe to use for display purposes.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文