Code example for NumberPicker

Methods: setDisplayedValuessetMaxValuesetMinValuesetValuesetWrapSelectorWheel

0
     * This method should be subclassed to update the spinners based on mCurrentDate. 
     */ 
    protected void updateSpinners() { 
        mPositionInYearSpinner.setDisplayedValues(null);
 
        // set the spinner ranges respecting the min and max dates 
        mPositionInYearSpinner.setMinValue(getMinPositionInYear());
        mPositionInYearSpinner.setMaxValue(getMaxPositionInYear());
        mPositionInYearSpinner.setWrapSelectorWheel(
                !mCurrentDate.equals(mMinDate) && !mCurrentDate.equals(mMaxDate));
 
        // year spinner range does not change based on the current date 
        mYearSpinner.setMinValue(getMinYear());
        mYearSpinner.setMaxValue(getMaxYear());
        mYearSpinner.setWrapSelectorWheel(false);
 
        // set the spinner values 
        mYearSpinner.setValue(getYear());
        mPositionInYearSpinner.setValue(getPositionInYear());
    } 
 
    /** 
     * Notifies the listener, if such, for a change in the selected date. 
     */ 
    protected void notifyDateChanged() { 
        sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_SELECTED);