2010-12-02 7 views

Antwort

20

Dies ist sehr einfach! :)

Cursor cursor = mContentResolver.query(
    RawContacts.CONTENT_URI, 
    new String[]{RawContacts._ID,RawContacts.ACCOUNT_TYPE}, 
    RawContacts.ACCOUNT_TYPE + " <> 'com.anddroid.contacts.sim' " 
    + " AND " + RawContacts.ACCOUNT_TYPE + " <> 'com.google' " //if you don't want to google contacts also 
    , 
    null, 
    null); 
+1

Können Sie bitte den Code schreiben, wie Sie die Nummer und den Namen von diesem Cursor erhalten. i stehen ganze den Code als „while (cursor.moveToNext()) {String phonenumber = cursor.getString (cursor.getColumnIndex (ContactsContract.CommonDataKinds.Phone.NUMBER)) schreiben; String name = cursor.getString (cursor.getColumnIndex (ContactsContract .Contacts.DISPLAY_NAME)); Log.i ("alle Kontakte", Telefonnummer anzeigen + "->" + name); \t \t \t} – Nency

+0

bekam aber den Fehler wie „: Bad Anfrage für Feldschlitz 0, -1. numRows = 46, numColumns = 2 – Nency

+1

'com.anddroid.contacts.sim' ist ein manueller Wert. Es gibt irgendeine Konstante, die sich darauf bezieht. – tana

Verwandte Themen