James
James

Reputation: 819

How to use intent to launch Add Contact activity?

I'm trying to launch add contact activity from my application. I've known how to call contact activity, but still unknown how to launch "Add Contact". I'm a beginner learning Android, please be specific. Thank you.

Upvotes: 4

Views: 5345

Answers (2)

Shaireen
Shaireen

Reputation: 3703

Try this code:

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

Upvotes: 2

Kannan Suresh
Kannan Suresh

Reputation: 4580

Intent intent = new Intent(
            ContactsContract.Intents.SHOW_OR_CREATE_CONTACT,
            Uri.parse("tel:" + phoneNumber));
        intent.putExtra(ContactsContract.Intents.EXTRA_FORCE_CREATE, true);
        startActivity(intent);

Upvotes: 10

Related Questions