【问题标题】:Intent that opens "new calendar event" activity打开“新日历事件”活动的意图
【发布时间】:2023-03-19 17:45:01
【问题描述】:

在我的应用程序中,我想要一个创建日历事件的功能。我像这样打开“新日历事件”活动:

Intent intent = new Intent(Intent.ACTION_EDIT);
intent.setType("vnd.android.cursor.item/event");
intent.putExtra("title", "Some title");
intent.putExtra("description", "Some description");
intent.putExtra("beginTime", eventStartInMillis);
intent.putExtra("endTime", eventEndInMillis);
startActivity(intent);

它在现有的 Android 上完美运行。在 HTC Sense 上,我只有一个问题 - 结束时间设置不正确,总是在开始时间后一小时。可能是什么问题?

【问题讨论】:

  • 日历不是 Android SDK 的一部分。您的代码可能无法在未来的 Android 版本中运行(例如,Android 2.2)。您的代码可能无法在已替换日历的各种设备上运行。请不要试图操纵日历。
  • 我知道这一点,但如果它适用于大多数设备,比我为所有设备删除此功能要好。我的应用在捷克共和国很有用,那里所有可用的设备都有库存 Android(添加到日历 100% 工作)或 HTC Sense(添加到日历功能只有小问题)。
  • @CommonsWare 客户想要他们得到什么 ;) 但很高兴知道这在 Android 上并不容易。已经跳出某种全球意图,所有日历应用程序都可以加入。

标签: android calendar android-intent


【解决方案1】:

问题是我的代码中有一个错误 - eventEndInMillis 的值是错误的,它比 eventStartInMillis 小。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多