简体   繁体   中英

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.

In this SO question you can see how to find the contact name from a phone number using PhoneLookup. You can use it for retrieving the id and lookup_key ( PhoneLookup reference ). But be aware that the phone number isn't unique, so you could get more than one contact.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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