Пример #1
0
  public static Intent createAddContactIntent(String address) {
    // address must be a single recipient
    Intent intent = new Intent(Intent.ACTION_INSERT_OR_EDIT);
    intent.setType(ContactsContract.Contacts.CONTENT_ITEM_TYPE);
    if (SmsHelper.isEmailAddress(address)) {
      intent.putExtra(ContactsContract.Intents.Insert.EMAIL, address);
    } else {
      intent.putExtra(ContactsContract.Intents.Insert.PHONE, address);
      intent.putExtra(
          ContactsContract.Intents.Insert.PHONE_TYPE,
          ContactsContract.CommonDataKinds.Phone.TYPE_MOBILE);
    }
    intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);

    return intent;
  }