Code example for NumberPicker

Methods: getMaxValuegetMinValue

0
        mSecondsSpinner.setMaxValue(59);
        mSecondsSpinner.setOnLongPressUpdateInterval(100);
        mSecondsSpinner.setFormatter(TWO_DIGIT_FORMATTER);
        mSecondsSpinner.setOnValueChangedListener(new NumberPicker.OnValueChangeListener() {
            public void onValueChange(NumberPicker spinner, int oldVal, int newVal) {
                int minValue = mSecondsSpinner.getMinValue();
                int maxValue = mSecondsSpinner.getMaxValue();
                if (oldVal == maxValue && newVal == minValue) {
                    int newMinute = mMinuteSpinner.getValue() + 1;
                    mMinuteSpinner.setValue(newMinute);
                } else if (oldVal == minValue && newVal == maxValue) {
                    int newMinute = mMinuteSpinner.getValue() - 1;
                    mMinuteSpinner.setValue(newMinute);
                } 
                onTimeChanged(); 
            } 
        }); 
//        mSecondsSpinnerInput = (EditText) mSecondsSpinner.findViewById(R.id.numberpicker_input); 
//        mSecondsSpinnerInput.setImeOptions(EditorInfo.IME_ACTION_NEXT); 
 
        // update controls to initial state