您的位置:首页 > 移动开发 > Android开发

android查找联系人,支持首屏,全拼

2013-04-19 21:42 369 查看
Uri uri = Uri.withAppendedPath(
ContactsContract.CommonDataKinds.Phone.CONTENT_FILTER_URI,
Uri.encode("hhh"));

Cursor cursor = getContentResolver().query(
uri,
new String[] {
ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME,
ContactsContract.CommonDataKinds.Phone.NUMBER }, null,
null, null);

System.out.println("total=========>" + cursor.getCount());
cursor.moveToFirst();
for (int i = 0; i < cursor.getCount(); i++) {
System.out.println(".name:" + cursor.getString(0) + ",number:"
+ cursor.getString(1));
cursor.moveToNext();
}
// while (cursor.moveToNext()) {

// System.out.println(".name:" + cursor.getString(0) + ",number:"
// + cursor.getString(1));
//
// }
cursor.close();



                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: