Nevermind. I got it to work. The new way to insert contacts is:

    Uri newPersonUri = Contacts.People
        .createPersonInMyContactsGroup(getContentResolver(), values);

On Aug 28, 4:45 pm, Michel Albert <[email protected]> wrote:
> 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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to