Code example for NumberPicker

Methods: setRange

0
    private void updateSpinnerRange() { 
        String[] khzStrings = getKHzStrings(mMin, mStep);
        int khzNumSteps = getKHzCount(mStep);
 
        mMHzPicker.setRange(mMin / 1000, mMax / 1000);
        mKHzPicker.setRange(1, khzNumSteps, khzStrings);
    } 
 
    private void updateSpinners() { 
        int khzNumSteps = getKHzCount(mStep);
        updateSpinnerRange(); 
        mMhz = (int) (mFrequency / 1000);
        mKhz = getCurrentKHz(mFrequency, mMin, mStep);
        if ((mMin / 1000 <= mMhz) && (mMax / 1000 >= mMhz)) {
            mMHzPicker.setCurrent(mMhz);
        } 
        if (mKhz <= khzNumSteps) {
            mKHzPicker.setCurrent(mKhz);
        } 
    }