Android NumberPicker - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android NumberPicker class.

This code example shows how to use the following methods: getMaxValue, getMinValue, setDisplayedValues, setMaxValue, setMinValue
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: setDisplayedValues, setMaxValue, setMinValue, setValue, setWrapSelectorWheel
 
    /** 
     * 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());

7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: clearFocus, getValue
        mNumberPicker.setValue(number);
    } 
 
    public void onClick(DialogInterface dialog, int which) {
        if (mCallback != null) {
            mNumberPicker.clearFocus();
            mCallback.onNumberSet(mDialogId, mNumberPicker.getValue());
            dialog.dismiss();
        } 
    } 
 
    @Override 
    public Bundle onSaveInstanceState() {
        Bundle state = super.onSaveInstanceState();
        state.putInt(NUMBER, mNumberPicker.getValue());
        return state;
    } 
 
    @Override 
    public void onRestoreInstanceState(Bundle savedInstanceState) {
Full Snippet Info
8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getMaxValue, getMinValue, setDisplayedValues, setMaxValue, setMinValue
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getMaxValue, getValue
    public void reloadPreference() { 
    } 
 
    private void updateInputState() { 
        if (mTimeLapseSwitch.isChecked()) {
            int newId = mUnitSpinner.getValue() * (mNumberSpinner.getMaxValue() + 1)
                    + mNumberSpinner.getValue() + 1;
            mPreference.setValueIndex(newId);
        } else { 
            mPreference.setValueIndex(0);
        } 
 
        if (mListener != null) {
            mListener.onListPrefChanged(mPreference);
        } 
    } 
} 
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Android NumberPicker Questions & Answers:

See Code Examples for Android NumberPicker Methods: