public void setDateFormat ( java . text . DateFormat dateFormat , java . text . DateFormat numbersDateFormat ) { this . customDateFormat = dateFormat ; this . secondaryDateFormat = numbersDateFormat ; // update the spinner with the new date format: // the only spinner item that will be affected is the month item, so just toggle the flag twice // instead of rebuilding the whole adapter if ( showMonthItem ) { int monthPosition = getAdapterItemPosition ( 4 ) ; boolean reselectMonthItem = getSelectedItemPosition ( ) == monthPosition ; setShowMonthItem ( false ) ; setShowMonthItem ( true ) ; if ( reselectMonthItem ) setSelection ( monthPosition ) ; } // if we have a temporary date item selected, update that as well if ( getSelectedItemPosition ( ) == getAdapter ( ) . getCount ( ) ) setSelectedDate ( getSelectedDate ( ) ) ; }
Sets the custom date format to use for formatting Calendar objects to displayable strings .