开发者

Android contact info update with intent?

开发者 https://www.devze.com 2023-01-25 05:39 出处:网络
I can create new contact with Intent by passing info as extra data with putExtra, is it possible to create Intent with info and if contact is already in phonebook it will be开发者_开发问答 update with

I can create new contact with Intent by passing info as extra data with putExtra, is it possible to create Intent with info and if contact is already in phonebook it will be开发者_开发问答 update with new info?


Actually you can use intents to create new contacts with ContactsContract and it's not deprecated.

http://developer.android.com/reference/android/provider/ContactsContract.Intents.Insert.html

example that works for me:

Intent i = new Intent(Intent.ACTION_INSERT_OR_EDIT);
i.setType(ContactsContract.Contacts.CONTENT_ITEM_TYPE);
i.putExtra(Insert.NAME, "TESTTEST");
i.putExtra(Insert.PHONE, "209384");
startActivity(i);


Using Intents to create new contacts is deprecated since Android 2.0. Use ContactsContract.

Here are the docs and an example.

0

精彩评论

暂无评论...
验证码 换一张
取 消