我在做错的地方,使用以下代码create event
进入Calendar
(使用JSON
解析从服务器获取日期)
for (int i = 0; i < appointmentsArrayList.size(); i++) {
try {
Log.d("check", appointmentsArrayList.get(i).getDate());
eventDate = new SimpleDateFormat("dd MMM yyyy").parse(appointmentsArrayList.get(i).getDate());
} catch (java.text.ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
答案 0 :(得分:5)
调用addToCalender();在你的for循环中
for (int i = 0; i < appointmentsArrayList.size(); i++) {
try {
Log.d("check", appointmentsArrayList.get(i).getDate());
eventDate = new SimpleDateFormat("dd MMM yyyy").parse(appointmentsArrayList.get(i).getDate());
addToCalender();
} catch (java.text.ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}