获取联系人的电话号码 Android 1.5
对于给定的 People._ID 列表,如何获取联系人电话号码?
private void getCntctList(List<GroupMembers> mids){
ArrayList<ContactItem> contact_list = new ArrayList<ContactItem>();
ContentResolver cr = getContentResolver();
String where = "People._ID IN (";
for (GroupMembers g : mids) {
where += g.personId + ",";
}
where = where.substring(0,where.length()-1) + ")";
Cursor contactCur = cr.query(????, null, where, null, null);
if (contactCur.getCount() > 0) {
while (contactCur.moveToNext()) {
...
}
}
}
For a given list of People._IDs how can I get the contacts phone number?
private void getCntctList(List<GroupMembers> mids){
ArrayList<ContactItem> contact_list = new ArrayList<ContactItem>();
ContentResolver cr = getContentResolver();
String where = "People._ID IN (";
for (GroupMembers g : mids) {
where += g.personId + ",";
}
where = where.substring(0,where.length()-1) + ")";
Cursor contactCur = cr.query(????, null, where, null, null);
if (contactCur.getCount() > 0) {
while (contactCur.moveToNext()) {
...
}
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想您想知道联系人的主要电话号码?你的代码是错误的。它应该是这样的:
I assume you want the primary phone number from the contact? Your code is wrong. It should be something like this: