Android Calendar API - edit/delete one event in a recurring series

我是研究僧i 提交于 2019-12-25 09:59:23

问题


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?

Regards Daniel


回答1:


Maybe this will help:

// 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();
}

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



来源:https://stackoverflow.com/questions/8888169/android-calendar-api-edit-delete-one-event-in-a-recurring-series

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!