material-calendarview icon indicating copy to clipboard operation
material-calendarview copied to clipboard

I updated to calendarview:2.0.0 and I am having a Null pointer Exception() #bug

Open crismaver1993 opened this issue 6 years ago • 1 comments

Caused by: android.view.InflateException: Binary XML file line #22: Binary XML file line #28: Binary XML file line #28: Error inflating class com.prolificinteractive.materialcalendarview.MaterialCalendarView

I just change 1.6.0 to 2.0.0 and I start getting this error.

Caused by: java.lang.NullPointerException: Attempt to read from field 'int com.prolificinteractive.materialcalendarview.CalendarMode.visibleWeeksCount' on a null object reference

I have this inside a Linearlayout in my xml layout

<com.prolificinteractive.materialcalendarview.MaterialCalendarView android:id="@+id/fragment_agenda_calendar" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/white" app:mcv_selectionColor="@color/primary_color_dark" app:mcv_tileHeight="48dp" />

I am doing the reference inside of my Fragment something like this: View rootView = inflater.inflate(R.layout.fragment_agenda, container, false); (rootView = My layout view reference)

calendarView = rootView.findViewById( R.id.fragment_agenda_calendar);

I do not why i am getting this error, i thought that it was happening because the 2.0.0 is using Vectors but I already add this compatibility in my Fragment and Activity.

crismaver1993 avatar Nov 02 '18 20:11 crismaver1993

In my case, I solutioned my code:

Like variable "calendarMode" is null:

... calendarMode = CalendarMode.MONTHS; ...

cahedral avatar Feb 06 '24 22:02 cahedral