How can I launch the 'Add Contact' activity in android

后端 未结 8 655
感情败类
感情败类 2020-11-30 00:15

Can you please tell me how to launch the Add Contact\' activity in android? Thank you.

8条回答
  •  感情败类
    2020-11-30 00:34

    I was also trying to do this. I was able to launch the activity using Android 2.2. I haven't tried using/testing this in other SDK versions though.

    Intent intent = new Intent(ContactsContract.Intents.SHOW_OR_CREATE_CONTACT, Uri.parse("tel:" + currentNum.getText())); //currentNum is my TextView, you can replace it with the number directly such as Uri.parse("tel:1293827")
    intent.putExtra(ContactsContract.Intents.EXTRA_FORCE_CREATE, true); //skips the dialog box that asks the user to confirm creation of contacts
    startActivity(intent);
    

    Hope this might help.

提交回复
热议问题