WEB开发网      婵犻潧鍊婚弲顐︽偟椤栨稓闄勯柦妯侯槸閻庤霉濠婂骸浜剧紒杈ㄥ笚閹峰懘鎮╅崹顐ゆ殸婵炴垶鎸撮崑鎾趁归悩鐑橆棄闁搞劌瀛╃粋宥夘敃閿濆柊锕傛煙鐎涙ê鐏f繝濠冨灴閹啴宕熼鍡╀紘婵炲濮惧Λ鍕叏閳哄懎绀夋繛鎴濈-楠炪垽鎮归崶褍妲婚柛銊ュ缁傚秹鏁撻敓锟� ---闂佹寧娲╅幏锟�
开发学院手机开发Android 开发 android读取手机通讯录 阅读

android读取手机通讯录

 2010-08-31 00:39:00 来源:WEB开发网 闂侀潧妫撮幏锟�闂佸憡鍨电换鎰版儍椤掑倵鍋撳☉娆嶄沪缂傚稄鎷�婵犫拃鍛粶闁靛洤娲ㄩ埀顒佺⊕閵囩偟绱為敓锟�闂侀潧妫撮幏锟�  闂佺ǹ绻楀▍鏇㈠极閻愬灚瀚梺鍨儏閳ь剙绉归弻銊р偓闈涙啞閻h京鈧敻鍋婇崰鏍х暦閿燂拷
核心提示:下面展示一段在Android1.5上读取手机通讯录的代码1 //链接通讯录数据库 2 ContentResolver content = getContentResolver(); 3 Cursor cursor = content.query(Contacts.People.CONTENT_URI, null, nu

下面展示一段在Android1.5上读取手机通讯录的代码

1 //链接通讯录数据库 2 ContentResolver content = getContentResolver(); 3 Cursor cursor = content.query(Contacts.People.CONTENT_URI, null, null, null, null); 4 //保存用户名信息 5 String[] nameList = new String[cursor.getCount()]; 6 //遍历通讯录 7 for(int i=0; i< cursor.getString(cursor.getColumnIndexOrThrow(Contacts.People.NUMBER));14 +=":" nameList[i]="cursor.getString(cursor.getColumnIndexOrThrow(Contacts.People.NAME));12" 获取电话13 获取人名11 cursor.moveToPosition(i);10 9 { 8 ;i++)>

读取到的通讯录显示在一个ListView上边 如下图

Tags:android 读取 手机

编辑录入:coldstar [复制链接] [打 印]
赞助商链接