简体   繁体   English

在Android中编辑或插入联系人意图

[英]Edit or insert contact intent in android

i have a contact number, if the contact exist in phone directory then i want to launch edit contact. 我有一个联系人号码,如果该联系人存在于电话目录中,则我要启动编辑联系人。

If the contact is fresh, i need to launch the edit contact screen and place the number in appropriate field. 如果联系人是新鲜的,我需要启动编辑联系人屏幕并将该号码放在适当的字段中。

Is there intent like this? 有这样的意图吗?

There is no intent for what you intend to do so you have to do it on your own. 您的意图没有意图,因此您必须自己做。

Here you have a brief tutorial for inserting and editing a contact using intents. 在这里,您有一个简短的教程,用于使用意图插入和编辑联系人。

I guess the best way is looking for the contact using PhoneLookup, if there is no result, send an ACTION_INSERT intent, if there is a result, send an ACTION_EDIT. 我猜最好的方法是使用PhoneLookup查找联系人,如果没有结果,则发送ACTION_INSERT意图,如果有结果,则发送ACTION_EDIT。

In this SO question you can see how to find the contact name from a phone number using PhoneLookup. 这个 SO问题中,您可以看到如何使用PhoneLookup从电话号码中查找联系人姓名。 You can use it for retrieving the id and lookup_key ( PhoneLookup reference ). 您可以使用它来检索id和lookup_key( PhoneLookup参考 )。 But be aware that the phone number isn't unique, so you could get more than one contact. 但是请注意,电话号码不是唯一的,因此您可以获得多个联系人。

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

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