String sPhone = "xxxx"; //查询的手机号
List<contactinfo> contactinfoList = new ArrayList<contactinfo>();
String[] projection = { ContactsContract.PhoneLookup.DISPLAY_NAME,
ContactsContract.CommonDataKinds.Phone.NUMBER};
Cursor cursor = null;
try{
cursor = context.getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
projection,
ContactsContract.CommonDataKinds.Phone.NUMBER +"= '"+ sPhone +"'",
null,
null);
while(raw_c.moveToNext()){
String name = raw_c.getString(raw_c.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME));
String number = raw_c.getString(raw_c.getColumnIndex(CommonDataKinds.Phone.NUMBER));
Log.i("
第十例:获取手机号获取本机通讯录中存储的姓名
最新推荐文章于 2024-06-01 09:53:09 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)