2
https://github.com/Tibolte/AgendaCalendarView/issues/119Android的Google日曆日程視圖活動入門搭接
當使用baseCalendar它拋出的Java空指針異常, 除了之後添加的事件,他們都得到在同一日期顯示,日期存在添加任何事件,事件列表最後一個對象的日期!
https://user-images.githubusercontent.com/29772646/28202935-2f535622-6895-11e7-9062-8a40b6d1752d.png
private void mockList(List eventList) {
Calendar calendar = new GregorianCalendar();
Calendar startTime1 = calendar.getInstance();
Calendar endTime1 = calendar.getInstance();
int day,month,year,hour,minute;
Date date = new Date();
DateFormat sdf=new SimpleDateFormat("MM/dd/yyyy HH:mm:ss aa");
// SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss aa");
//6/5/2017 12:00:00 AM
try {
date =(Date) sdf.parse("7/14/2017 10:00:00 AM");
} catch (ParseException e) {
e.printStackTrace();
}
day=date.getDate();
month=date.getMonth();
year=date.getYear();
hour=date.getHours();
minute=date.getMinutes();
// startTime1.set(Calendar.YEAR,year);
startTime1.set(Calendar.MONTH,month);
startTime1.set(Calendar.DAY_OF_MONTH, day);
startTime1.set(Calendar.HOUR_OF_DAY, hour);
startTime1.set(Calendar.MINUTE, minute);
endTime1 = startTime1;
eventList.add(new BaseCalendarEvent("First Event: Date 14", "A wonderful
journey!", "LOL",
ContextCompat.getColor(this, R.color.orange_dark), startTime1,
endTime1, true));
try {
date =(Date) sdf.parse("7/15/2017 5:00:00 AM");
} catch (ParseException e) {
e.printStackTrace();
}
day=date.getDate();
month=date.getMonth();
year=date.getYear();
hour=date.getHours();
minute=date.getMinutes();
// startTime1.set(Calendar.YEAR,year);
startTime1.set(Calendar.MONTH,month);
startTime1.set(Calendar.DAY_OF_MONTH, day);
startTime1.set(Calendar.HOUR_OF_DAY, hour);
startTime1.set(Calendar.MINUTE, minute);
endTime1 = startTime1;
/*
BaseCalendarEvent event1 = new BaseCalendarEvent("Thibault travels in
Iceland",
"A wonderful journey!", "Iceland",
ContextCompat.getColor(this, R.color.orange_dark), startTime1, endTime1,
false);
eventList.add(event1);
*/
eventList.add(new BaseCalendarEvent("SEcond Event: Date 15", "A wonderful
journey!", "LOL",
ContextCompat.getColor(this, R.color.orange_dark), startTime1,
endTime1, true));
Calendar startTime3 = Calendar.getInstance();
Calendar endTime3 = Calendar.getInstance();
startTime3.set(Calendar.DAY_OF_MONTH,16);
startTime3.set(Calendar.HOUR_OF_DAY, 16);
startTime3.set(Calendar.MINUTE, 0);
endTime3.set(Calendar.HOUR_OF_DAY, 15);
endTime3.set(Calendar.MINUTE, 0);
DrawableCalendarEvent event3 = new DrawableCalendarEvent("Visit of Harpa",
"", "Dalvík",
ContextCompat.getColor(this, R.color.blue_dark), startTime3,
endTime3, false, android.R.drawable.ic_dialog_info);
eventList.add(event3);
}