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

1.3k Views Asked by At

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

There are 1 best solutions below

1
On

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