1
嗨,我試圖調用創建聯繫人表單與預填充數據,並能夠在基本的細節。我能夠輸入姓名,電子郵件,電話號碼,但我無法加載聯繫人的縮略圖。代碼的相關部分是:傳遞圖像網址來創建一個新的聯繫活動android
// 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);
任何關於如何完成此操作的指針。謝謝 !
@thanks PRATIK指出這和url..i已過去雖然鏈接你provided..looks像其直接添加聯繫人到數據庫,但我所尋找的是我去AddContactActivity與縮略圖預先關聯。 – Deva
如果你能指點我一些需要預覽縮略圖的AddContactActivity的東西,那就太好了。 – Deva
我會再看看這個,讓你知道。 –