Hi all.

I have made a program that it add contact to the G1, but this is in
Favorites and not in the correct section Contacts.

My code is:

        ContentValues values = new ContentValues();
        Uri phoneUri = null;

        values.put(Contacts.People.NAME, "New Contact 1");
        //1 = the new contact is added to favorites
        //0 = the new contact is not added to favorites
        values.put(Contacts.People.STARRED,1);

        //Add Phone Numbers
        Uri uri = getContentResolver().insert(Contacts.People.CONTENT_URI,
values);

        //The best way to add Contacts data like Phone, email, IM is to
        //get the CONTENT_URI of the contact just inserted from People's
table,
        //and use withAppendedPath to construct the new Uri to insert into.
        phoneUri = Uri.withAppendedPath(uri,
Contacts.People.Phones.CONTENT_DIRECTORY);

        values.clear();
        values.put(Contacts.Phones.TYPE, Phones.TYPE_MOBILE);
        values.put(Contacts.Phones.NUMBER, "1233214567");
        getContentResolver().insert(phoneUri, values);

If i change the line values.put(Contacts.People.STARRED,1); to
values.put(Contacts.People.STARRED,0);     the contact example inst in
Contacts and Favorites also, :-(((

How can i make the new conctact is in the list of Contacts and not in
Favorites?.

Thanks.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" 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-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to