using the Android SDK> 5, I create a contact by running the ACTION_INSERT action. I want to add several phone numbers (work, home, etc.) for the contact using the following code:
Intent newIntent = new Intent(Intent.ACTION_INSERT,
ContactsContract.Contacts.CONTENT_URI);
for(ContactInfo.Phone p : phones)
{
newIntent.putExtra(ContactsContract.Intents.Insert.PHONE, p.number);
newIntent.putExtra(ContactsContract.Intents.Insert.PHONE_ISPRIMARY, p.isPrimary ? new Integer(1) : null);
newIntent.putExtra(ContactsContract.Intents.Insert.PHONE_TYPE, unconvertPhoneType(p.type));
}
(unconvertPhoneType () is a function to get the type CommonDataKinds.Phone.TYPE_XXX)
I have only one example inserted in contact. What is wrong with this?
In addition, in LogCat logs, I also have the following error:
12-14 11: 09: 03.015: WARN / Bundle (1724): Key phone_type expected String, but the value was java.lang.Integer. The default value has been returned.
it looks like it comes from PHONE_TYPE, however CommonDataKinds.Phone.TYPE_XXX is of type integer, so I'm not sure ... What is the reason for this?
Thank!