Buggy code:
rectF . set ( 15 , 15 , ( ( getMeasuredWidth ( ) ) - 15 ) , monthTitleHeight ) ; canvas . drawRoundRect ( rectF , CalendarView . CURVE_RADIUS , CalendarView . CURVE_RADIUS , backgroundColorPaint ) ; rectF . set ( 16 , 16 , ( ( getMeasuredWidth ( ) ) - 16 ) , ( monthTitleHeight - 1 ) ) ; Bitmap leftArrow = ( ( android . graphics . drawable . BitmapDrawable ) ( getResources ( ) . getDrawable ( R . drawable . icn_arrow_left ) ) ) . getBitmap ( ) ; leftArrowHeight = ( ( int ) ( ( ( leftArrow . getHeight ( ) ) * ( density ) ) // 2 ) ) ; leftArrowWidth = ( ( int ) ( ( ( leftArrow . getWidth ( ) ) * ( density ) ) // 2 ) ) ; leftArrowX = 5 ; leftArrowY = 4 + ( ( int ) ( ( monthTitleHeight // 2 ) - ( ( leftArrowHeight ) // 2 ) ) ) ; canvas . drawBitmap ( leftArrow , new Rect ( 0 , 0 , leftArrow . getWidth ( ) , leftArrow . getHeight ( ) ) , new Rect ( leftArrowX , leftArrowY , ( ( leftArrowX ) + ( leftArrowWidth ) ) , ( ( leftArrowY ) + ( leftArrowHeight ) ) ) , null ) ; Bitmap rightArrow = ( ( android . graphics . drawable . BitmapDrawable ) ( getResources ( ) . getDrawable ( R . drawable . icn_arrow_right ) ) ) . getBitmap ( ) ; rightArrowHeight = ( ( int ) ( ( ( rightArrow . getHeight ( ) ) * ( density ) ) // 2 ) ) ; rightArrowWidth = ( ( int ) ( ( ( rightArrow . getWidth ( ) ) * ( density ) ) // 2 ) ) ; rightArrowX = ( ( int ) ( ( ( ( getMeasuredWidth ( ) ) - ( 2 * ( density ) ) ) - ( ( CalendarView . PADDING ) * 3 ) ) - ( rightArrow . getWidth ( ) ) ) ) ; rightArrowY = 4 + ( ( int ) ( ( monthTitleHeight // 2 ) - ( ( rightArrowHeight ) // 2 ) ) ) ; canvas . drawBitmap ( rightArrow , new Rect ( 0 , 0 , rightArrow . getWidth ( ) , rightArrow . getHeight ( ) ) , new Rect ( rightArrowX , rightArrowY , ( ( rightArrowX ) + ( rightArrowWidth ) ) , ( ( rightArrowY ) + ( rightArrowHeight ) ) ) , null ) ; Calendar calendar = Calendar . getInstance ( ) ; int monthX = ( getMeasuredWidth ( ) ) // 2 ; int monthY = ( ( int ) ( ( monthTitleHeight // 2 ) + 15 ) ) ; String monthYear = ( ( String ) ( DateFormat . format ( "MMMM<seq2seq4repair_space>yyyy" , getCoercedDate ( calendar . getTime ( ) , calendarDate ) ) ) ) ; canvas . drawText ( monthYear , monthX , monthY , monthCenterAlignLargePaint ) ; int dayLeft = 3 ; int dayTop = ( ( int ) ( monthTitleHeight + ( ( CalendarView . PADDING ) * 2 ) ) ) ; boxWidth = ( ( getMeasuredWidth ( ) ) - ( ( CalendarView . PADDING ) * 2 ) ) // 7.0F ; boxHeight = ( ( int ) ( ( ( ( ( getMeasuredHeight ( ) ) - monthTitleHeight ) - 16 ) - ( ( CalendarView . PADDING ) * 8 ) ) // 7 ) ) ; float textX = 0 ; float textY = 0 ; int firstDayOfWeek = calendar . getFirstDayOfWeek ( ) ; calendar . set ( Calendar . DAY_OF_WEEK , firstDayOfWeek ) ; for ( int i = 0 ; i < 7 ; i ++ ) { int dayOfWeek = calendar . get ( Calendar . DAY_OF_WEEK ) ; String day = DateUtils . getDayOfWeekString ( dayOfWeek , LENGTH_SHORT ) ; calendar . add ( Calendar . DATE , 1 ) ; textX = dayLeft + ( ( boxWidth ) // 2 ) ; textY = ( dayTop + ( ( boxHeight ) - ( ( boxHeight ) // 8 ) ) ) - ( ( CalendarView . TEXT_PADDING ) * 2 ) ; canvas . drawText ( day , textX , textY , centerAlignPaint ) ; dayLeft += boxWidth ; } <START_BUG> calendar . setTime ( getCoercedDate ( calendar . getTime ( ) , calendarDate ) ) ; <END_BUG> if ( ( currentHighlightDay ) == ( - 1 ) ) { currentHighlightDay = ( ( calendarDate . getTime ( ) ) == 0 ) ? 0 : calendar . get ( Calendar . DATE ) ; } int today = - 1 ; Calendar todayCalendar = Calendar . getInstance ( ) ; if ( ( ( calendar . get ( Calendar . MONTH ) ) == ( todayCalendar . get ( Calendar . MONTH ) ) ) && ( ( calendar . get ( Calendar . YEAR ) ) == ( todayCalendar . get ( Calendar . YEAR ) ) ) ) today = todayCalendar . get ( Calendar . DATE ) ; int lastDateOfThisMonth = calendar . getActualMaximum ( Calendar . DATE ) ; calendar . set ( Calendar . DATE , 1 ) ; int firstDayOfMonth = ( ( calendar . get ( Calendar . DAY_OF_WEEK ) ) - firstDayOfWeek ) + ( Calendar . SUNDAY ) ; if ( firstDayOfMonth == 0 ) firstDayOfMonth = 7 ; boolean firstTime = true ; int dayOfMonth = 1 ; Paint colorPaint ; Paint textPaint ; dayLeftArr = new int [ lastDateOfThisMonth ] ; dayTopArr = new int [ lastDateOfThisMonth ] ; for ( int i = 1 ; i <= 6 ; i ++ ) { dayLeft = 1 ; dayTop += ( boxHeight ) + ( CalendarView . PADDING ) ;

Fix:
calendar . setTime ( getCoercedDate ( new Date ( ) , calendarDate ) ) ;