Android日历API-编辑/删除重复序列中的一个事件
我可以添加和删除新的定期事件,但如何使用新的Android日历API编辑/删除定期事件中的一个事件?如果可能,我如何更新一个事件的提醒 向丹尼尔致意也许这会有帮助:Android日历API-编辑/删除重复序列中的一个事件,android,android-calendar,recurring-events,Android,Android Calendar,Recurring Events,我可以添加和删除新的定期事件,但如何使用新的Android日历API编辑/删除定期事件中的一个事件?如果可能,我如何更新一个事件的提醒 向丹尼尔致意也许这会有帮助: // First retrieve the instances from the API. Events instances = service.events().instances("primary", "recurringEventId").execute(); // Select the instance to edit E
// First retrieve the instances from the API.
Events instances = service.events().instances("primary", "recurringEventId").execute();
// Select the instance to edit
Event instance = instances.getItems().get(0);
if(youWantToCancel) {
instance.setStatus("canceled");
instance.setReminders(yourReminders);
Event updatedInstance = service.events().update("primary", instance.getId(), instance).execute();
}
if(youWantToDelete){
instance.setId("ToBeDeleted")
service.events().delete("primary", instance.getId()).execute();
}
如果要删除重复周期中的多个事件,只需将ID设置为一些明显的字符串,如“ToBeDeleted”,然后执行:service.events().delete(“主”,
“ToBeDeleted”).execute()代码>
请参见谢谢您的回复,它看起来不错,但我还没有时间测试它,但我让您知道了!