private @ Nullable Calendar getNextItemDate ( Calendar searchDate ) { final int last = dateSpinner . getLastItemPosition ( ) ; for ( int i = 0 ; i <= last ; i ++ ) { final Calendar date = ( ( DateItem ) dateSpinner . getItemAtPosition ( i ) ) . getDate ( ) ; // use the DateSpinner's compare method so hours and minutes are not considered if ( DateSpinner . compareCalendarDates ( date , searchDate ) >= 0 ) return date ; } // not found return null ; }
Gets the next date item s date equal to or later than the given date in the DateSpinner . Requires that the items are in ascending order .