查询手机和sim卡上的联系人信息(名字,号码,头像)

方法一     :  http://blog.csdn.net/xys289187120/article/details/6730957

 

 

方法二  :  

 // 遍历所有的电话号码

        Cursor phoneCur = getContentResolver().query(
    ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
    null,
    null,
    null, null);

 

 

private void initContactInfos(Cursor phoneCur) {
  // TODO Auto-generated method stub
  if (phoneCur == null) return;
  phoneCur.move(-1);
  while (phoneCur.moveToNext()) {
   ContactInfo contactInfo = new ContactInfo();
   contactInfo.personId = phoneCur.getLong(phoneCur.getColumnIndex(ContactsContract.CommonDataKinds.Phone.CONTACT_ID));
   contactInfo.number = phoneCur.getString(phoneCur.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
   contactInfo.name = phoneCur.getString(phoneCur.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME));
   if (contactInfo.name == null) {
    contactInfo.name = contactInfo.number;
   }
   
   mContactInfos.add(contactInfo);
  }
 }

你可能感兴趣的:(null,手机,电话)