prolificinteractive / material-calendarview

A Material design back port of Android's CalendarView
https://prolificinteractive.github.io/material-calendarview/
MIT License
5.91k stars 1.32k forks source link

Unable to select date (in latest release) #1053

Open shahzad1 opened 3 years ago

shahzad1 commented 3 years ago

I'm trying to select date using CalendarDay calendarDay = CalendarDay.today(); calendarView.setSelectedDate(calendarDay);

But it shows this error **error: cannot access LocalDate class file for org.threeten.bp.LocalDate not found** I also tried CalendarDay calendarDay = CalendarDay.from(year, month, day); calendarView.setSelectedDate(calendarDay);

and this is how i'm getting Day, Month & Year

Calendar calendar = Calendar.getInstance(); int day = calendar.get(Calendar.DAY_OF_MONTH); int month = calendar.get(Calendar.MONTH) + 1; int year = calendar.get(Calendar.YEAR);

I'm currently using latest release implementation 'com.github.prolificinteractive:material-calendarview:2.0.1'

anallur commented 3 years ago

The latest versions of Material CalendarView library uses LocalDate instead of Calendar class from Java Util. You will need to add dependency of com.jakewharton.threetenabp:threetenabp:$version in ur build.gradle

aivision369 commented 1 year ago

I am facing same issue and I got solution after adding this library in the build.gradle file. implementation 'com.jakewharton.threetenabp:threetenabp:1.2.1'

and I have implemented code as below : materialCalendarView.setSelectedDate(CalendarDay.today());