java - Is there any way to detect month change in android calendar view(i.e. when user changes calendar to another month) -
i want month shown in calendar view , cant figure out. tried
calendarview.setondatechangelistener(new calendarview.ondatechangelistener() { @override public void onselecteddaychange(calendarview view, int year, int month, int dayofmonth) { int d = dayofmonth; int m = month; log.d("month", "" + m); string curdate = string.valueof(d); } });
but triggers when user click days of month. want when user changes month want changed month(i.e. month shown in calendar view.) appreciated. in advance.
i think android's default calendarview can't achieve want. need implement custom calendar or other library provides implementation or provides listeners or gestures swiping between months. refer link if helps you: material-calendeview
and sample code:
materialcalendarview calendarview = new materialcalendarview(getactivity()); calendarview.setonmonthchangedlistener(new onmonthchangedlistener() { @override public void onmonthchanged(materialcalendarview widget, calendarday date) { //do date date1 = date.getdate(); } });
hope helps you.
Comments
Post a Comment