我在日历中添加全天活动超过1天示例" 2015-02-27T00:00:00 + 00:00"到" 2015-02-28T00:00:00 + 00:00"
问题是:由于时间是00:00,因此仅添加27而不是28。我想在27和28两个中添加。
代码是
public static void addToCalendar(Context context, String title,
String description, String location, long timeStart, long timeEnd,boolean allDay, String id ) {
// Uri EVENTS_URI = Uri.parse(getCalendarUriBase(true) + "events");
Calendar cal = Calendar.getInstance();
ContentValues values = new ContentValues();
values.put("calendar_id", 1);
values.put("title", title);
//values.put("allDay", 0);
values.put("dtstart", timeStart);
values.put("dtend", timeEnd);
values.put("description", "");
values.put("hasAlarm", 1);
values.put(Events.ALL_DAY, true);
String timeZone = TimeZone.getDefault().getID();
values.put("eventTimezone", timeZone);
Uri ur = getCalendarURI(true);
context.getContentResolver().insert(ur, values);
}
答案 0 :(得分:0)
从" 2015-02-27T00:00:00 + 00:00"到" 2015-02-29T00:00:00 + 00:00和#34;
或强>
从" 2015-02-27T00:00:00 + 00:00"到" 2015-02-28T23:59:59 + 00:00和#34;
两者都会增加27天和28天全天活动