我正在尝试使用此方法插入事件,它正在正确执行但联系人中没有联系人事件。
private static void addEvent(ArrayList<ContentProviderOperation> contact_list,
ContactDataBean contactBean, int rawContactID){
contact_list.add(ContentProviderOperation
.newInsert(ContactsContract.Data.CONTENT_URI)
.withValueBackReference(
ContactsContract.Data.RAW_CONTACT_ID,
rawContactID)
.withValue(ContactsContract.Data.MIMETYPE,
ContactsContract.CommonDataKinds.Event.CONTENT_ITEM_TYPE)
.withValue(ContactsContract.CommonDataKinds.Event.TYPE,
ContactsContract.CommonDataKinds.Event.TYPE_OTHER)
.withValue(ContactsContract.CommonDataKinds.Event.START_DATE,
contactBean.value).build());
try {
// Executing all the insert operations as a single
// database
// transaction
context.getContentResolver().applyBatch(
ContactsContract.AUTHORITY, contact_list);
Toast.makeText(context, "Contact is successfully added",
Toast.LENGTH_SHORT).show();
} catch (RemoteException e) {
e.printStackTrace();
} catch (OperationApplicationException e) {
e.printStackTrace();
}
}
没有错误,也没有插入任何事件。
有什么问题??