Note that there are some explanatory texts on larger screens.

plurals
  1. POandroid edit contact
    primarykey
    data
    text
    <p>hi im trying to add a phone number to an existing contact on android 2.1. Im currently using:</p> <pre><code>ContentValues values = new ContentValues(); values.put(Phone.RAW_CONTACT_ID,cursor.getColumnIndex(Phone.CONTACT_ID)); String selection = ContactsContract.Contacts.IN_VISIBLE_GROUP + " = '1'"; ContentResolver cr = getContentResolver(); Cursor cursor = cr.query(ContactsContract.Contacts.CONTENT_URI,null, selection, null,ContactsContract.Contacts.DISPLAY_NAME+" COLLATE LOCALIZED ASC"); if (cursor.getCount() &gt; 0) { cursor.moveToPosition(oldcontactid); contactid = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts._ID)); values.put(Phone.RAW_CONTACT_ID,cursor.getColumnIndex(Phone.CONTACT_ID)); if (Integer.parseInt(cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER))) &gt; 0) { Cursor pCur = cr.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI,null,ContactsContract.CommonDataKinds.Phone.CONTACT_ID +" = ?",new String[]{contactid}, null); while (pCur.moveToNext()) { values.put(Phone.NUMBER,pCur.getString(pCur.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER))); values.put(Phone.TYPE, Phone.TYPE_MOBILE); } pCur.close(); } } Uri uri = getContentResolver().insert(Phone.CONTENT_URI, values); </code></pre> <p>but i get an error:</p> <pre><code>java.lang.UnsupportedOperationException: Unknown uri: content://com.android.contacts/data/phones </code></pre> <p>how would i be able to fix this?</p> <p>thanks for any help, ng93</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload