Hallo Ich möchte einen Kontakt aus unserer Standard-Kontaktbuchabsicht auswählen. Ich habe verschiedene Möglichkeiten ausprobiert. Bitte finden Sie den Code unten. Das Problem mit all diesen Codes ist, dass sie einen Bildschirm für Zwischendokumente mit wenigen Optionen öffnen, wo der Benutzer den Kontakt auswählen muss und dann das Kontaktbuch öffnet.Wählen Sie den Kontakt direkt aus der Kontaktauswahl Absicht
private void openContactIntent() {
Intent intent = new Intent(Intent.ACTION_GET_CONTENT, ContactsContract.Contacts.CONTENT_URI);
intent.setType(ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE);
startActivityForResult(intent, REQ_CONTACT_DIRECTORY);
}
Ich habe auch versucht
Intent intent = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI);
startActivityForResult(intent, PICK_CONTACT);
und
Intent intent = new Intent(Intent.ACTION_PICK);
intent.setType(ContactsContract.Contacts.CONTENT_TYPE);
startActivityForResult(intent, PICK_CONTACT);
Was ich als Zwischen Bildschirm zu sehen ist
'Intent Absicht = new Intent (Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI) ; startActivityForResult (Absicht, PICK_CONTACT); 'Es funktioniert für mich! –
Ist es mit einem Betriebssystem verbunden? Ich führe Code auf Android N. Und für mich funktioniert es nicht. Ich habe keine Berechtigungen hinzugefügt. –
Ich betreibe auch Android N! –