Hi,
I am trying to programmically add a new contact in android.
What I did is this:
Uri uri = Contacts.People.CONTENT_URI;
values.put(Contacts.PeopleColumns.NAME, "mydummyuser1");
Uri newuri = myActivity.getContentResolver().insert(uri,
values);
Uri phoneUri = Uri.withAppendedPath(newuri,
Contacts.People.Phones.CONTENT_DIRECTORY);
values.clear();
values.put(Contacts.PhonesColumns.ISPRIMARY, 1);
values.put(Contacts.PhonesColumns.TYPE,
Contacts.PhonesColumns.TYPE_CUSTOM);
values.put(Contacts.PhonesColumns.LABEL, "Other");
String formattedPhone =
PhoneNumberUtils.formatNumber("5556667777");
values.put(Contacts.PhonesColumns.NUMBER, formattedPhone);
Uri newPhoneUri =
myActivity.getContentResolver().insert(phoneUri, values);
But as soon as I kill and restart my emulator, the contact that I add is gone.
Can you please tell me why?
Thank you.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---