Android Calendar API-周期性地编辑/删除一个活动 [英] Android Calendar API - edit/delete one event in a recurring series
本文介绍了Android Calendar API-周期性地编辑/删除一个活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我可以添加和删除新的重复事件,但是如何使用新的Android Calendar API在重复事件中编辑/删除一个事件?如果可能的话,如何在一个事件上更新提醒?
I can add and delete a new recurring event, but how can I edit/delete one event in a recurring event using the new Android Calendar API? And if it is possible how do I update a reminder on one event?
关于丹尼尔
推荐答案
也许这会有所帮助:
// 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("primary",
"ToBeDeleted").execute();
请参见文档
If you want to delete multiple events within a recurrence, simply set the ids to some obvious string like "ToBeDeleted" and perform: service.events().delete("primary",
"ToBeDeleted").execute();
See docs
这篇关于Android Calendar API-周期性地编辑/删除一个活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文