通过ContentResolver和ContactsContract访问通讯录示例
可以使用ContentResolver的query方法访问ContactsContract.CommonDataKinds.Phone.CONTENT_URI,遍历返回的Cursor对象,从中读取联系人的姓名和电话号码等字段。调用Cursor的getColumnIndex获取字段索引,使用getString读取数据,遍历后关闭Cursor。
通过ContentResolver和ContactsContract访问通讯录示例
可以使用ContentResolver的query方法访问ContactsContract.CommonDataKinds.Phone.CONTENT_URI,遍历返回的Cursor对象,从中读取联系人的姓名和电话号码等字段。调用Cursor的getColumnIndex获取字段索引,使用getString读取数据,遍历后关闭Cursor。