使用“ContactsContract”从联系人检索电话号码通过身份证?
我可以使用 id 代码检索联系人的显示名称,如下所示:
Uri uri = ContentUris.withAppendedId(ContactsContract.Contacts.CONTENT_URI, selectedid);
Cursor cur = managedQuery(uri, null, null, null, null);
startManagingCursor(cur);
cur.moveToNext();
String mname = cur.getString(cur.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
其中“selectedid”是我要检索的联系人的 id。 现在我在从该 ID 检索电话号码时遇到问题。
如果可能的话,您可以输入我必须添加的代码来从该 ID 获取电话号码吗
I'm able to retrieve the display name of contact using the id Code as follows:
Uri uri = ContentUris.withAppendedId(ContactsContract.Contacts.CONTENT_URI, selectedid);
Cursor cur = managedQuery(uri, null, null, null, null);
startManagingCursor(cur);
cur.moveToNext();
String mname = cur.getString(cur.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
Where the "selectedid" is my id of the contact to be retrieved.
Now i have a problem in retrieving the phone number from that id.
If possible can u type me the code which i have to add to get the phone number from that id
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你有没有尝试过:
Have you tried:
我有点想通了....尝试下面的链接...
i kind of figured it out .... try the link bellow...