I am trying to insert a new contact, but, even though I get a valid
URI back, the Contacts do not appear in the "Contacts" application.

Code:

    ContentValues values = new ContentValues();
    values.put( People.NAME, contact.getString("name") );
    Uri uri = getContentResolver().insert(People.CONTENT_URI, values);

    Uri phoneUri = null;
    phoneUri = Uri.withAppendedPath(uri,
People.Phones.CONTENT_DIRECTORY);
    values.clear();
    values.put(People.Phones.TYPE, People.Phones.TYPE_MOBILE);
    values.put(People.Phones.NUMBER, phone.getString("number"));
    getContentResolver().insert(phoneUri, values);

My problem lies already in the first three lines. The contact does not
seem to be stored. However, consecutive runs of this show, that the
internal ID is increased nonetheless.

Is there something I am missing? Do you have to "commit" the changes?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to