获取通讯录

//sdk1.6中不可用
  /*Cursor phone = cr.query(
    ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
    null, null,
    null, null);
 后来改用:
Cursor phone = cr.query(People.CONTENT_URI, null, null, null, null);
   
   if (phone.getCount() > 0) {

    phone.moveToFirst();
    String number;
    String name;
    String typeInt;
    do {
     ContactBean contactBean = new ContactBean();
     number = phone
       .getString(phone
         .getColumnIndex(People.NUMBER));
     name = phone
       .getString(phone
         .getColumnIndex(People.NAME));
     typeInt = phone
         .getString(phone
          .getColumnIndex(People.TYPE)); 
    
    } while (phone.moveToNext());
   }
   phone.close();

你可能感兴趣的:(获取通讯录)