简体   繁体   English

如何在Android日历中为自定义帐户创建事件?

[英]How to create a event in android calendar for custom account?

I want to add my own server calendar events to android. 我想将自己的服务器日历事件添加到android。 I already done contact synchronization from my custom account. 我已经从我的自定义帐户完成了联系人同步。

But I cannot find code for create a event in calendar for my custom account. 但是我找不到用于在日历中为自定义帐户创建事件的代码

any source code or links welcome. 欢迎任何源代码或链接。

you have to create the event and add it to the calendar with the 您必须创建事件并将其添加到日历中

 ContentValues values = new ContentValues();
 values.put(some parameter..., value);

 contentResolver.insert(CalendarContract.events, values );

The key of the thing is that you have to bind your event to the calendar by the ID of the calendar. 事情的关键是您必须通过日历的ID将事件绑定到日历。 So one of the parameter should be look like this in values.put() 因此,其中一个参数应在values.put()中看起来像这样

 values.put(Events.CALENDAR_ID, calID);

Tutorial on this site Add event to calendar 本网站上的教程将事件添加到日历

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM