【发布时间】:2011-09-13 04:39:54
【问题描述】:
我正在尝试将项目放入日历中,但不知道如何对其进行编码。这是我目前所拥有的,但它会将其插入到主日历中。
String calName;
String calId = null;
String[] projection = new String[] { "_id", "name" };
Uri calendars = Uri.parse("content://calendar/calendars");
Cursor managedCursor = managedQuery(calendars, projection, null, null, null);
ContentValues event = new ContentValues();
event.put("calendar_id", calId);
event.put("title", strTitle);
event.put("description", strDescription);
event.put("eventLocation", strLocation);
event.put("dtstart", StartTime);
event.put("dtend", EndTime);
Uri eventsUri = Uri.parse("content://calendar/events");
Uri calUri = getContentResolver().insert(eventsUri, event);
所以我的问题是:
如何创建自己的日历以将事件放入
如何将我的事件插入到该日历中(使用上面的代码或新代码)
如何检查事件是否已存在
~~~更新:~~~
我正在尝试做的是我的用户将输入标题和日期,我的应用程序将采用该标题和日期,将它们放入数据库(到目前为止我所做的一切),现在我想要获取标题和日期,并将它们放入专门用于我的应用程序事件的特殊日历中。我需要做的第一件事是让应用程序创建一个新日历。比将事件插入到下面的代码帮助我做的那个日历中。还在玩它。比我想重新运行我的应用程序并检查事件是否存在。就是这样。
【问题讨论】:
-
请帮忙回答这个问题。 stackoverflow.com/questions/37658179/…
标签: android insert calendar exists