I've already implemented this listener in order for me to display something when a certain date is clicked, but the problem is that when i scroll the CalendarView down, it automatically displayed something but i didn't click anything, i just scrolled down to anther month in CalendarView and then there goes a, say a Toast or a Log, whichever (I guess it makes sense since the listener itself fires `onDateChange and since scrolling down the calendar also changes the date currently selected). So my question is that is there any listener for CalendarView that i might use just a alternative to ondateChange listener, inorder to avoid the situation that when i scroll down the calendarView to go to another month it automatically fired the lisntener.
Anyone who knows an alternative listner to CalendarView or anyone knows a workaround? please do share
When you are scrolling the calendar onSelectedDayChange
method behaves like you click on different date but that won't change current date settings. So HFDO5 was right, you just need to save current date when you create your calendar:
Long date = calendar.getDate();
and check it in onSelectedDayChange
.
if(callendar.getDate() != date){
date = calendar.getDate(); //new current date
//date is changed on real click...do things..
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With