开发者

Parse Contact detail by URI

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜