是不是该加个什么permission。看你的错误信息,应该程序没什么错误,可能就是少了个什么东西...

解决方案 »

  1.   

    下面这个是允许程序读取用户联系人数据,,main.xml中已添加了
    <uses-permission 
    android:name="android.permission.READ_CONTACTS">
    </uses-permission>
      

  2.   

      Cursor cursor = cr.query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null);
      cursor.moveFirst();
      //向下移动一下光标
      while(cursor.moveToNext())
      

  3.   

    很多函数,如获取数据之类的需要catch来进行防错。
      

  4.   

    lz的sdk版本是不是2.0以上的?2.0以上的直接调用
    int numberFieldColumnIndex = cursor.getColumnIndex(PhoneLookup.NUMBER);  
      String number = cursor.getString(numberFieldColumnIndex);是不好用的,需要根据contactId来调用不好用的
    String contactId = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts._ID)); //获取联系人的ID号,在SQLite中的数据库ID
    Cursor phone = cr.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null,    ContactsContract.CommonDataKinds.Phone.CONTACT_ID + " = " 
             + contactId, null, null);
     
    while (phone.moveToNext())
    {
           String strPhoneNumber = phone.getString(phone.getColumnIndex (ContactsContract.CommonDataKinds.Phone.NUMBER)); //手机号码字段联系人可能不止一个         string +=   strPhoneNumber;
    } 试试好用不