【问题标题】:Parse Contact detail by URI通过 URI 解析联系人详细信息
【发布时间】:2011-07-02 08:29:10
【问题描述】:

我想知道有没有一种方法可以通过联系人列表接收到的特定 uri 地址来解析联系人详细信息(号码、电子邮件等)

示例: //假设数据变量ia已经填充了从联系人列表中提取的特定联系人的uri地址

Uri 联系人 = 联系人 = data.getData();

我怎样才能通过电话号码、电子邮件、组织等准确地解析联系人详细信息..?

谢谢,

射线。

【问题讨论】:

    标签: android android-sdk-2.1 android-contacts


    【解决方案1】:

    对于您可以使用的电子邮件

    // query for everything email
                cursor = getContentResolver().query(Email.CONTENT_URI, null,
                        Email.CONTACT_ID + "=?", new String[] { id }, null);
    
                int emailIdx = cursor.getColumnIndex(Email.DATA);
    
                // let's just get the first email
                if (cursor.moveToFirst()) {
                 String email = cursor.getString(emailIdx);
                }
    

    用电话更改电子邮件您将获得联系号码。

    【讨论】:

    • 是的,但是您将如何在此查询中提供 URI?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-05-08
    • 1970-01-01
    • 2012-02-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多