开发者

Parse Contact detail by URI

开发者 https://www.devze.com 2023-03-16 17:30 出处:网络
I was wondering is there is a way of parsing a contact details (number,email etc.) by a specific uri add开发者_开发问答ress which received by the contact list

I was wondering is there is a way of parsing a contact details (number,email etc.) by a specific uri add开发者_开发问答ress which received by the contact list

example: //assume that the data variable ia already populated with a uri address of a specific contact which was picked up from the contact list

Uri contact = contact = data.getData();

how could I acutely parse the contact details by it's number, email, organisation and so on..?

thanks,

ray.


For Email you can use

// 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);
            }

Change Email with Phone you'll get contact no.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号