//链接通讯录数据库
          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));
         }

posted on 2012-10-06 00:35  承志软件.张  阅读(433)  评论(1编辑  收藏  举报