アプリケーションを作成したところ、ボタンを押して選択した番号を取得すると、電話の連絡先を取得できました。
私の問題は、電話の連絡先しか表示されず、SIM の連絡先が表示されないことです。
私のコードは次のとおりです。
@Override
    public void onActivityResult(int reqCode, int resultCode, Intent data) {
        super.onActivityResult(reqCode, resultCode, data);
        if (resultCode!=0){
             Uri uri = data.getData();
             Cursor cursor=this.getContentResolver().query(uri, null, null, null, null);
                while (cursor.moveToNext()) { 
                String contactId = cursor.getString(cursor.getColumnIndex( 
                  ContactsContract.Contacts._ID)); 
                String hasPhone = cursor.getString(cursor.getColumnIndex( 
                  ContactsContract.Contacts.HAS_PHONE_NUMBER)); 
                if ((Integer.parseInt(cursor.getString( cursor.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER))) > 0)) { 
                             // You know have the number so now query it like this
             Cursor phones = getContentResolver().query( 
               ContactsContract.CommonDataKinds.Phone.CONTENT_URI, 
               null, 
               ContactsContract.CommonDataKinds.Phone.CONTACT_ID +" = "+ contactId, 
                   null, null); 
                 while (phones.moveToNext()) { 
                  phoneNumber = phones.getString( 
                   phones.getColumnIndex( 
                      ContactsContract.CommonDataKinds.Phone.NUMBER));
                 } 
                 phonenumber.setText(phoneNumber);
                 phones.close(); 
                } 
              }
        }
    }
そして、私が理解できない何か。
インテント インテント = 新しいインテント(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI); startActivity(意図);
すべての連絡先を表示しますが、1つを選択できず、結果を得ることができません
インテント インテント = 新しいインテント(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI); startActivityForResult(意図、1);
電話の連絡先のみを表示するのはなぜですか?