Code example for NumberPicker

Methods: getMaxValuesetValue

0
            mTimeLapseSwitch.setChecked(false);
            setTimeSelectionEnabled(false); 
        } else { 
            mTimeLapseSwitch.setChecked(true);
            setTimeSelectionEnabled(true); 
            int durationCount = mNumberSpinner.getMaxValue() + 1;
            int unit = (index - 1) / durationCount;
            int number = (index - 1) % durationCount;
            mUnitSpinner.setValue(unit);
            mNumberSpinner.setValue(number);
        } 
    } 
 
    @Override 
    public void setVisibility(int visibility) {
        if (visibility == View.VISIBLE) {
            if (getVisibility() != View.VISIBLE) {
                // Set the number pickers and on/off switch to be consistent 
                // with the preference 
                restoreSetting(); 
            }