1
내부 연락처 활동을 사용하여 새 연락처를 만들고 싶습니다. 다음은 코드입니다 :SHOW_OR_CREATE_CONTACT 동작으로 안드로이드 인 텐트를 올바르게 설정하는 방법은 무엇입니까?
Intent i = new Intent();
i.setAction(ContactsContract.Intents.SHOW_OR_CREATE_CONTACT);
i.addCategory(Intent.CATEGORY_DEFAULT);
i.setData(Uri.fromParts("tel", "12345678", null));
i.putExtra(ContactsContract.Intents.EXTRA_FORCE_CREATE, true);
i.putExtra(ContactsContract.CommonDataKinds.Phone.TYPE, ContactsContract.CommonDataKinds.Phone.TYPE_WORK);
i.putExtra(ContactsContract.Intents.Insert.EMAIL, "[email protected]");
i.putExtra(ContactsContract.CommonDataKinds.Email.TYPE, ContactsContract.CommonDataKinds.Email.TYPE_WORK);
i.putExtra(ContactsContract.CommonDataKinds.StructuredName.FAMILY_NAME, "Ide");
i.putExtra(ContactsContract.CommonDataKinds.StructuredName.GIVEN_NAME, "Vele");
i.putExtra(ContactsContract.CommonDataKinds.Organization.COMPANY, "Company name");
i.putExtra(ContactsContract.CommonDataKinds.Organization.TYPE, ContactsContract.CommonDataKinds.Organization.TYPE_WORK);
i.putExtra(ContactsContract.CommonDataKinds.Organization.LABEL, "label");
i.putExtra(ContactsContract.CommonDataKinds.Organization.TITLE, "job title");
i.putExtra(ContactsContract.CommonDataKinds.Organization.DEPARTMENT, "department");
i.putExtra(ContactsContract.CommonDataKinds.Organization.JOB_DESCRIPTION, "job description");
i.putExtra(ContactsContract.CommonDataKinds.Organization.SYMBOL, "symbol");
i.putExtra(ContactsContract.CommonDataKinds.Organization.OFFICE_LOCATION, "office location");
하지만이 코드는 부분적으로 만 작동합니다. 활동에는 전화 번호와 전자 메일 주소 만 표시되고 다른 필드는 설정되어 있지 않습니다. 여기
에뮬레이터의 스크린 샷이다 : 그것을 포함하지 않는 edit_contact1죄송합니다,하지만 난 이미지를 포함 할 수있는 충분한 명성을 필요가 없습니다.
도움이 될 것입니다.
일부 업데이트 : 다음 코드는 '주어 이름'필드를 설정합니다.
i.putExtra(ContactsContract.Intents.Insert.NAME, "simple name");