I\'m debugging an issue where the CalendarView
in a DatePicker
moves to October 1964 if there is a non-default minimum date set. This reproduces at
I agree with @laalto. The original CalendarView
is a total mess. I also had problems with the locales, the font size on Android 4.1.2 (oh yeah and it was shifted down), the lack of accessibility features, etc. So I decided to copy the source code and implement my own calendar. For example, now the header text is displayed correctly.
/**
* The source code has the Year 2038 problem and doesn't honor CalendarView's mCurrentLocale.
*/
private void setMonthDisplayed(Calendar calendar) {
mMonthName.setText(DateFormat.format("MMMM, yyyy", calendar));
mMonthName.invalidate();
mCurrentMonthDisplayed = calendar.get(Calendar.MONTH);
mAdapter.setFocusMonth(mCurrentMonthDisplayed);
}
/**
* This imlementation formats the date correctly and uses the stand-alone form of a month (for the languages where it's important).
*/
private void setMonthDisplayed(Calendar calendar) {
mMonthName.setText(new SimpleDateFormat("LLLL yyyy", mCurrentLocale).format(calendar.getTime()));
mMonthName.invalidate();
mCurrentMonthDisplayed = calendar.get(Calendar.MONTH);
mAdapter.setFocusMonth(mCurrentMonthDisplayed);
}