我正在尝试按照https://github.com/tyczj/ExtendedCalendarView说明向日历添加活动。日历显示但我没有看到日期颜色的任何变化。
在我的onCreate方法中,我添加了
calendar = (ExtendedCalendarView)findViewById(R.id.calendar);
ContentValues values = new ContentValues();
values.put(CalendarProvider.COLOR, Event.COLOR_BLUE);
values.put(CalendarProvider.DESCRIPTION, "Some Description");
values.put(CalendarProvider.LOCATION, "Some location");
values.put(CalendarProvider.EVENT, "Event name");
Calendar cal = Calendar.getInstance();
TimeZone tz = TimeZone.getDefault();
cal.set(2015, 8, 1, 1, 1);
int StartDayJulian = Time.getJulianDay(cal.getTimeInMillis(), TimeUnit.MILLISECONDS.toSeconds(tz.getOffset(cal.getTimeInMillis())));
values.put(CalendarProvider.START, cal.getTimeInMillis());
values.put(CalendarProvider.START_DAY, StartDayJulian);
cal.set(2015, 8, 1, 1, 1);
int endDayJulian = Time.getJulianDay(cal.getTimeInMillis(), TimeUnit.MILLISECONDS.toSeconds(tz.getOffset(cal.getTimeInMillis())));
values.put(CalendarProvider.END, cal.getTimeInMillis());
values.put(CalendarProvider.END_DAY, endDayJulian);
Uri uri = getContentResolver().insert(CalendarProvider.CONTENT_URI, values);
感谢您的帮助。