Code example for NumberPicker

Methods: getMaxValuegetMinValue

0
                int year = getYear();
                int positionInYear = getPositionInYear();
                // take care of wrapping of days and months to update greater fields 
                if (picker == mPositionInYearSpinner) {
                    positionInYear = newVal;
                    if (oldVal == picker.getMaxValue() && newVal == picker.getMinValue()) {
                        year += 1;
                    } else if (oldVal == picker.getMinValue() && newVal == picker.getMaxValue()) {
                        year -=1;
                    } 
                } else if (picker == mYearSpinner) {
                    year = newVal;
                 } else { 
                    throw new IllegalArgumentException();
                } 
 
                // now set the date to the adjusted one 
                setCurrentDate(year, positionInYear);
                updateSpinners(); 
                notifyDateChanged(); 
            }