samedi 27 juin 2015

Add event to Week view library

I'm using this library : http://ift.tt/1rtrYBv And I want that when I click on an empty space, an event will show up on the calendar, but it doesnt..The event is added to events variable. but you cant see it in the calendar
here is my code:

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


   mWeekView.setEmptyViewClickListener(new WeekView.EmptyViewClickListener() {
            @Override
            public void onEmptyViewClicked(Calendar calendar) {

                Calendar cal2 = (Calendar) calendar.clone();
                cal2.add(Calendar.HOUR, 1);
                WeekViewEvent event = new WeekViewEvent(1,"Hello", calendar, cal2);
                event.setColor(getActivity().getResources().getColor(R.color.event_color_01));
                events.add(event);

                events.add(event);
                onMonthChange(2015,5);
            }
        });


 @Override
    public List<WeekViewEvent> onMonthChange(int newYear, int newMonth) {
    return events;
}

Aucun commentaire:

Enregistrer un commentaire