简体   繁体   English

有意图的Android联系信息更新?

[英]Android contact info update with intent?

我可以通过使用putExtra将信息作为额外数据传递来创建与Intent的新联系,是否可以使用信息创建Intent,如果联系人已经在电话簿中,它将使用新信息进行更新?

Actually you can use intents to create new contacts with ContactsContract and it's not deprecated. 实际上,您可以使用Intent来创建与ContactsContract的新联系人,并且不会弃用它。

http://developer.android.com/reference/android/provider/ContactsContract.Intents.Insert.html 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. 自Android 2.0起,不推荐使用Intents创建新联系人。 Use ContactsContract . 使用ContactsContract

Here are the docs and an example . 这是文档示例

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM