diff --git a/materialcalendarview/src/main/java/io/blackbox_vision/materialcalendarview/view/CalendarView.java b/materialcalendarview/src/main/java/io/blackbox_vision/materialcalendarview/view/CalendarView.java index 76d74ff..8b2fc6e 100644 --- a/materialcalendarview/src/main/java/io/blackbox_vision/materialcalendarview/view/CalendarView.java +++ b/materialcalendarview/src/main/java/io/blackbox_vision/materialcalendarview/view/CalendarView.java @@ -262,15 +262,14 @@ protected void onRestoreInstanceState(Parcelable state) { currentMonthIndex = savedInstanceState.getInt(KEY_MONTH_INDEX); if (savedInstanceState.getSerializable(KEY_SELECTED_DATE) != null) { lastSelectedDay = (Date) savedInstanceState.getSerializable(KEY_SELECTED_DATE); + } else { + lastSelectedDay = new Date(); } } - Calendar calendar = (lastSelectedDay != null) ? getCalDate(lastSelectedDay) : Calendar.getInstance(Locale.getDefault()); + Calendar calendar = getCalDate(lastSelectedDay); update(calendar); - - if (lastSelectedDay != null) { - markDateAsSelected(lastSelectedDay); - onDateClickListener.onDateClick(lastSelectedDay); - } + markDateAsSelected(lastSelectedDay); + onDateClickListener.onDateClick(lastSelectedDay); } super.onRestoreInstanceState(state);