Example usage for android.widget NumberPicker getId

List of usage examples for android.widget NumberPicker getId

Introduction

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

Prototype

@IdRes
@ViewDebug.CapturedViewProperty
public int getId() 

Source Link

Document

Returns this view's identifier.

Usage

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

private void configurePicker(NumberPicker picker) {

    picker.setMinValue(15);/*ww  w. jav a2s  .co m*/
    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));
        }
    });
}