Open thilinakj opened 4 years ago
Having the same issue.
I investigated further. The problem seems to be happening when calling SingleDateTimePicker#setDefaultDate(Date)
on the last day of a month where there are more days in that month than in the next month (31 days in March, 30 days in April).
@florent37 It would be nice to get a fix released for this soon as the issue will happen again on May 31. I submitted a PR for it: https://github.com/florent37/SingleDateAndTimePicker/pull/266
This issue can be closed now. Fixed in v2.2.1.
I am using library in xml layout.
<com.github.florent37.singledateandtimepicker.SingleDateAndTimePicker android:id="@+id/datePicker" android:layout_margin="@dimen/side_padding" android:layout_width="match_parent" android:layout_height="wrap_content" app:picker_curved="true" app:picker_cyclic="true" app:picker_displayMinutes="false" app:picker_displayHours="false" app:picker_displayDays="false" app:picker_displayMonth="true" app:picker_displayYears="true" app:picker_displayDaysOfMonth="true" app:picker_visibleItemCount="5" />
This worked perfectly in previous days. But as today is 31 st of March the following exception was thrown and as a result, app happens to crash.
java.lang.IndexOutOfBoundsException: Index: 30, Size: 30 at java.util.ArrayList.get(ArrayList.java:437) at com.github.florent37.singledateandtimepicker.widget.WheelPicker.setDefaultDate(WheelPicker.java:261) at com.github.florent37.singledateandtimepicker.SingleDateAndTimePicker.setDefaultDate(SingleDateAndTimePicker.java:487) at com.github.florent37.singledateandtimepicker.SingleDateAndTimePicker.onAttachedToWindow(SingleDateAndTimePicker.java:223) at android.view.View.dispatchAttachedToWindow(View.java:17400)