How to use the intention to start Add Contact?

I am trying to start the add contacts function from my application. I know how to trigger contact activity, but so far it’s not known how to launch “Add Contact”. I'm starting to learn Android, please be specific. Thanks.

+4
source share
2 answers
Intent intent = new Intent( ContactsContract.Intents.SHOW_OR_CREATE_CONTACT, Uri.parse("tel:" + phoneNumber)); intent.putExtra(ContactsContract.Intents.EXTRA_FORCE_CREATE, true); startActivity(intent); 
+10
source

Try this code:

  Intent i = new Intent(Intent.ACTION_INSERT_OR_EDIT); i.setType(ContactsContract.Contacts.CONTENT_ITEM_TYPE); startActivity(i); 
+2
source

Source: https://habr.com/ru/post/1380320/


All Articles