如何在NexusOne中添加event到Calendar?

polarman 2010-05-13 01:23:20
如题。试过下面的代码,返回的newEvent URI是有效的,但是在日历中看不到。
ContentValues event = new ContentValues();
event.put("calendar_id", "1");
event.put("title", "Event title");
event.put("description", content);
event.put("dtstart", meetingInfo.m_lStartTime);
event.put("dtend", meetingInfo.m_lEndTime);
event.put("hasAlarm", 1); // 0 for false, 1 for true
Uri eventsUri = Uri.parse("content://calendar/events");

final ContentResolver cr = getContext().getContentResolver();
Uri newEvent = cr.insert( eventsUri, event );
...全文
78 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
Sodino 2010-05-13
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 polarman 的回复:]

找到原因了。是我传入的dtend不合法。误传了"0"进去。
[/Quote]

恭喜...

接分...
polarman 2010-05-13
  • 打赏
  • 举报
回复
找到原因了。是我传入的dtend不合法。误传了"0"进去。
infsafe 2010-05-13
  • 打赏
  • 举报
回复
重新启动呢?

80,350

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧