pcatzj
V2EX  ›  Android

求教 Android 日历事件操作中 EventID 的问题

  •  
  •   pcatzj · Feb 7, 2017 · 12877 views
    This topic created in 3570 days ago, the information mentioned may be changed or developed.

    通过intent插入日历事件 上图是 Android 官方文档中通过 intent 跳转到日历来进行插入事件操作的示例代码。

    查看日历事件

    上面这张图是文档中编辑事件的代码,其中需要用到 eventID ,但是插入的过程中并没有指定 eventID 的操作,事后也无法查询到(搜索未果),那么这个 eventID 我应该怎么获取呢?

    3 replies  •  2017-02-08 10:36:14 +08:00
    dreamingincode
    dreamingincode
    Feb 7, 2017
    1
    因为用的是 Intent ,你可以尝试 startActivityForResult ,然后在 onActivityResult 里打印出所有返回的内容,寻找有没有包含这个 Id 的 extra 。但是我觉得这又可能没有什么保证(完全看日历应用的编写者?我没见到过相关的约定。

    另外一种方法就是是自己用 ContentResolver 查询了。
    pcatzj
    pcatzj
    OP
    Feb 7, 2017
    2
    @dreamingincode 试了,点击保存,仍然回调 RESULT_CANCEL ,而且 data 是 null
    pcatzj
    pcatzj
    OP
    Feb 8, 2017
    3
    使用 ContentProvider 可以指定 EventID 插入事件,所以使用 Intent 添加有办法做到吗
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1069 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 18:46 · PVG 02:46 · LAX 10:46 · JFK 13:46
    ♥ Do have faith in what you're doing.