Android-Week-View: Problem with set event

Hello, I have 2 dates: 15-01-2015 14:00, timestamp: 1421330400 15-01-2015 15:00, timestamp: 1421334000 and I want to set Event like this: @Override public List<WeekViewEvent> onMonthChange(int newYear, int newMonth) {

    List<WeekViewEvent> events = new ArrayList<WeekViewEvent>();

    GregorianCalendar startTime = new GregorianCalendar();
    startTime.setTimeInMillis(1421330400*1000);
    GregorianCalendar endTime = new GregorianCalendar();
    endTime.setTimeInMillis(1421334000*1000);

    WeekViewEvent event = new WeekViewEvent(1, getEventTitle(startTime), startTime.get(Calendar.YEAR) , startTime.get(Calendar.MONTH), startTime.get(Calendar.DAY_OF_MONTH), startTime.get(Calendar.HOUR_OF_DAY), startTime.get(Calendar.MINUTE), endTime.get(Calendar.YEAR) , endTime.get(Calendar.MONTH), endTime.get(Calendar.DAY_OF_MONTH), endTime.get(Calendar.HOUR_OF_DAY), endTime.get(Calendar.MINUTE));
    event.setColor(getResources().getColor(R.color.event_color_01));
    events.add(event);

    return events;
}

but event don’t show on calendar, how to do this?

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 31 (17 by maintainers)

Commits related to this issue

Most upvoted comments

onMonthChange is called three times (when you don’t scroll) This is in the README!

Please remember that the calendar pre-loads events of three consecutive months to enable lag-free scrolling.

That’s why it’s being shown multiple times.

(You have to take in account the newMonth and newYear variables. They are there for a reason)