【问题标题】:Android Calendar API - edit/delete one event in a recurring seriesAndroid Calendar API - 编辑/删除重复系列中的一个事件
【发布时间】:2012-02-11 21:01:10
【问题描述】:

我可以添加和删除新的定期活动,但如何使用新的 Android 日历 API 编辑/删除定期活动中的一个活动?如果可能的话,我该如何更新一个事件的提醒?

问候丹尼尔

【问题讨论】:

    标签: android android-calendar recurring-events


    【解决方案1】:

    也许这会有所帮助:

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

    【讨论】:

    • 感谢您的回复,看起来不错,但我还没来得及测试,但我让您知道了!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-02-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-09-08
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多