嗨,我正在尝试使用预先填充的数据调用创建联系人表单并能够输入基本详细信息。我可以输入姓名、电子邮件、电话号码,但我无法加载联系人的缩略图。代码的相关部分是:
// Creates a new intent for sending to the device's contacts application
Intent insertIntent = new Intent(ContactsContract.Intents.Insert.ACTION);
// Sets the MIME type to the one expected by the insertion activity
insertIntent.setType(ContactsContract.RawContacts.CONTENT_TYPE);
/**
* Added this extra for 4.0 device as on save the onActivityResult was
* not getting invoked rather a new activity was invoked
**/
String INTENT_KEY_FINISH_ACTIVITY_ON_SAVE_COMPLETED = "finishActivityOnSaveCompleted";
insertIntent.putExtra(INTENT_KEY_FINISH_ACTIVITY_ON_SAVE_COMPLETED,
true);
// Sets the new contact name
insertIntent.putExtra(ContactsContract.Intents.Insert.NAME,
"name");
insertIntent.putExtra(ContactsContract.Intents.Insert.PHONE,
(Utility.formatPhoneNumber(mCellNumber)));
insertIntent.putExtra(ContactsContract.Intents.Insert.PHONE_TYPE,
Phone.TYPE_MOBILE);
insertIntent.putExtra(ContactsContract.Intents.Insert.SECONDARY_PHONE,
(Utility.formatPhoneNumber(mOfficeNumber)));
insertIntent.putExtra(
ContactsContract.Intents.Insert.SECONDARY_PHONE_TYPE,
Phone.TYPE_WORK);
**insertIntent.putExtra(
ContactsContract.Intents.ATTACH_IMAGE,getPhotoUrl());**
// Send out the intent to start the device's contacts app in its add
// contact activity.
startActivityForResult(insertIntent,
REQUEST_CODE_ADD_NEW_CONTACT);
关于如何做到这一点的任何指针。谢谢 !