Code example for NumberPicker

Methods: setMaxValuesetMinValuesetValue

0
    private void updateDaySpinner() { 
        Calendar cal = Calendar.getInstance();
        // if year was not set, use 2000 as it was a leap year 
        cal.set(mHasYear ? mYear : 2000, mMonth, 1);
        int max = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
        mDayPicker.setMinValue(1);
        mDayPicker.setMaxValue(max);
        mDayPicker.setValue(mDay);
    } 
 
    public int getYear() { 
        return (mYearOptional && !mHasYear) ? 0 : mYear;
    } 
 
    public int getMonth() { 
        return mMonth;
    } 
 
    public int getDayOfMonth() { 
        return mDay;
    }