CosmoCalendar
CosmoCalendar copied to clipboard
Select date programmatically
Hi,
Is it possible to select a day in the calendar programmatically? So I want to do something like calendar.SelectDate(date);
and that it then selects the date in the calendar visually.
Thanks!
Hi,
after setting your selection manage, for example:
calendarView.setSelectionManager(new RangeSelectionManager(new OnDaySelectedListener() { @Override public void onDaySelected() { } }));
then you can set a first and a second day, to specify your range:
` Day firstDay = new Day(dateStart); Day secondDay = new Day(dateEnd);
calendarView.clearSelections();
calendarView.getSelectionManager().toggleDay(firstDay);
calendarView.getSelectionManager().toggleDay(secondDay);
` hope this helps
Hi,
after setting your selection manage, for example:
calendarView.setSelectionManager(new RangeSelectionManager(new OnDaySelectedListener() { @Override public void onDaySelected() { } }));
then you can set a first and a second day, to specify your range:
` Day firstDay = new Day(dateStart); Day secondDay = new Day(dateEnd);
calendarView.clearSelections(); calendarView.getSelectionManager().toggleDay(firstDay); calendarView.getSelectionManager().toggleDay(secondDay);
` hope this helps
After trying out your solution using (.setSelectionManager), I'm only getting a StackOverflow error, I could not see the selected dates visually, what could be the issue?
How do i set the current month the calendar should should show pro grammatically since i tried settingManager and selection manager but it does not help set current month;