问题
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