Example usage for android.widget NumberPicker.OnValueChangeListener NumberPicker.OnValueChangeListener

List of usage examples for android.widget NumberPicker.OnValueChangeListener NumberPicker.OnValueChangeListener

Introduction

In this page you can find the example usage for android.widget NumberPicker.OnValueChangeListener NumberPicker.OnValueChangeListener.

Prototype

NumberPicker.OnValueChangeListener

Source Link

Usage

From source file:com.jaguarlandrover.hvacdemo.MainActivity.java

private void configurePicker(NumberPicker picker) {

    picker.setMinValue(15);/*from   ww  w .ja v a 2s.c  om*/
    picker.setMaxValue(29);

    picker.setWrapSelectorWheel(false);
    picker.setDisplayedValues(new String[] { "LO", "16", "17", "18", "19", "20", "21", "22",
            "23", "24", "25", "26", "27", "28", "HI" });

    picker.setDescendantFocusability(NumberPicker.FOCUS_BLOCK_DESCENDANTS);

    picker.setOnValueChangedListener(new NumberPicker.OnValueChangeListener() {
        /* USER INTERFACE CALLBACK */
        @Override
        public void onValueChange(NumberPicker picker, int oldVal, int newVal) {
            Log.d(TAG, Util.getMethodName());

            HVACManager.invokeService(getServiceIdentifiersFromViewId(picker.getId()),
                    Integer.toString(newVal));
        }
    });
}