1.打开系统通讯录
Intent intent = new Intent(Intent.ACTION_PICK,android.provider.ContactsContract.Contacts.CONTENT_URI); startActivityForResult(intent, 1);
2.接收返回值
Uri uri = data.getData(); String string = ""; // 得到ContentResolver对象 ContentResolver cr = getContentResolver(); // 取得电话本中开始一项的光标 Cursor cursor = cr.query(uri, null, null, null, null); // 向下移动光标 while (cursor.moveToNext()) { // 取得联系人名字 int nameFieldColumnIndex = cursor .getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME); String contact = cursor.getString(nameFieldColumnIndex); //如果值为1,则该联系人至少有一个电话号码;如果值为0,则该联系人没有电话号码 String ContactId = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts._ID)); Cursor phone = cr.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, ContactsContract.CommonDataKinds.Phone.CONTACT_ID + "=" + ContactId, null, null); while(phone.moveToNext()) { String Number = phone.getString(phone.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER)); string += (contact + ":" + Number + " "); } Toast.makeText(NewsActivity.this,string,Toast.LENGTH_LONG).show(); }