//链接通讯录数据库
ContentResolver content = getContentResolver();
Cursor cursor = content.query(Contacts.People.CONTENT_URI, null, null, null, null);
//保存用户名信息
String[] nameList = new String[cursor.getCount()];
//遍历通讯录
for(int i=0; i<cursor.getCount() ;i++)
{
cursor.moveToPosition(i);
//获取人名
nameList[i] = cursor.getString(cursor.getColumnIndexOrThrow(Contacts.People.NAME));
//获取电话
nameList[i] += ":" + cursor.getString(cursor.getColumnIndexOrThrow(Contacts.People.NUMBER));
}