Diese Auswahl-Klausel in meinem Cursor Abfrage gibt nur die Kontakte, die eine Telefonnummer haben, das ist, was ich will: canWie kann ich Telefonnummern von entsprechenden Namen in meinen Kontakten erhalten?
// this query only return contacts with phone number and is not duplicated
phones = getContentResolver().query(
// the table to query
ContactsContract.Contacts.CONTENT_URI,
// the columns to return
null,
// selection criteria :
// we only want contacts that have a name and a phone number. If they have a phone number, the value is 1 (if not, it is 0)
ContactsContract.Contacts.IN_VISIBLE_GROUP + " = '" + ("1") + "'" + " AND " + ContactsContract.Contacts.HAS_PHONE_NUMBER + "=1",
// selection criteria
null,
// display in ascending order
ContactsContract.Contacts.DISPLAY_NAME + " COLLATE LOCALIZED ASC");
Aber wie:
// we only want contacts that have a name and a phone number. If they have a phone number, the value is 1 (if not, it is 0)
ContactsContract.Contacts.IN_VISIBLE_GROUP + " = '" + ("1") + "'" + " AND " + ContactsContract.Contacts.HAS_PHONE_NUMBER + "=1",
Meine ganze Cursor Abfrage sieht wie folgt aus Ich bekomme die tatsächliche Telefonnummer für jeden Kontakt? Kann ich dem obigen Code etwas hinzufügen oder muss ich eine neue Cursor-Abfrage starten?
Ich denke, es ist das letztere.
Ich begann eine neue Cursor-Abfrage als Ausgangspunkt: Ich
phonestwo = getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
null,
ContactsContract.CommonDataKinds.Phone.IN_VISIBLE_GROUP + " = '" + ("1") + "'" + " AND " + ContactsContract.CommonDataKinds.Phone.HAS_PHONE_NUMBER + "=1",
null,
null);
Aber in Protokollen in logcat bin immer die Telefone Cursor 134 Datensätze hat (richtig, was ich will!) Und meine phonestwo Cursor hat 196 Aufzeichnungen. Kurz gesagt, wie kann ich Telefonnummern erhalten, die diesen 134 Datensätzen entsprechen?