Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 594
James Avatar asked Dec 17 '22 07:12

James


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);
like image 91
Kannan Suresh Avatar answered Jan 06 '23 17:01

Kannan Suresh


Try this code:

 Intent i = new Intent(Intent.ACTION_INSERT_OR_EDIT);
 i.setType(ContactsContract.Contacts.CONTENT_ITEM_TYPE);   
 startActivity(i);
like image 21
Shaireen Avatar answered Jan 06 '23 17:01

Shaireen