CalendarView in Android not showing correct month -
i have implemented calendarview in android app. have strange issue on selection of date. month showing april 2015 in top toast showing 1/3/2015? if scroll may 2015 toast shows 1/4/2015. month previous month.
i doing this:
calendar =(calendarview) findviewbyid(r.id.calendarforstart); calendar.setshowweeknumber(false); calendar.setfirstdayofweek(2); calendar.setondatechangelistener(new ondatechangelistener() { @override public void onselecteddaychange(calendarview view, int year, int month, int day) { toast.maketext(getapplicationcontext(), day + "/" + month + "/" + year, toast.length_long).show(); } });
please check snapshot:
did notice in top shows april 2015 below toast shows 1/3/2015.. why happening?
can me fix this?
thanks!
month start 0. jan-dec
0-11
you need change month+1
toast.maketext(getapplicationcontext(), day + "/" + (month+1) + "/" + year, toast.length_long).show();
Comments
Post a Comment