如何使用联系人合同添加两个或多个地址?我有三个邮政地址要添加,但我没有看到任何secondary_address像一个电话/电子邮件。任何人都可以帮助我吗? 谢谢!
答案 0 :(得分:0)
这对我有用。
其中listSize - >联系人数量
for(int i = 0; i< listSize; i ++){
values.clear();
values.put(Data.MIMETYPE, Phone.CONTENT_ITEM_TYPE);
values.put(Phone.IS_PRIMARY, true);
values.put(Phone.TYPE, Phone.TYPE_CUSTOM);
values.put(Phone.LABEL, "Work "+(i+1));
values.put(Data.RAW_CONTACT_ID, rawContactId);
values.put(Phone.NUMBER, allContacts.get(wanted.get(i)).getPhone());
getContentResolver().insert(Data.CONTENT_URI, values);
values.clear();
values.put(Data.MIMETYPE, StructuredPostal.CONTENT_ITEM_TYPE);
values.put(StructuredPostal.TYPE, Phone.TYPE_CUSTOM);
values.put(StructuredPostal.LABEL, "Work "+(i+1));
values.put(Data.RAW_CONTACT_ID, rawContactId);
values.put(StructuredPostal.STREET, allContacts.get(wanted.get(i)).street);
values.put(StructuredPostal.CITY, allContacts.get(wanted.get(i)).city);
values.put(StructuredPostal.REGION, allContacts.get(wanted.get(i)).state);
values.put(StructuredPostal.POSTCODE, allContacts.get(wanted.get(i)).zipCode);
getContentResolver().insert(Data.CONTENT_URI, values);
}