I need to implement a View with two numberPicker, pickerOne and pickerTwo. pickerTwo values depending on current value of pickerOne, so when user scroll pickerOne, values inside pickerTwo change. I've implement pickerOne like:
NumberPicker pickerOne= new NumberPicker(context);
pickerOne.setLayoutParams(new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
pickerOne.setDescendantFocusability(NumberPicker.FOCUS_BLOCK_DESCENDANTS);
pickerOne.setWrapSelectorWheel(false);
pickerOne.setMinValue(0);
pickerOne.setMaxValue(pickerOneValues.length-1);
pickerOne.setDisplayedValues(pickerOneValues);
pickerOne.setOnValueChangedListener(new NumberPicker.OnValueChangeListener() {
@Override
public void onValueChange(NumberPicker numberPicker, int i, int i1) {
Log.d("VALUE", "" + i1);
updatePickerTwoValues(i1);
}
});
This code work well only if user do a step by step spin (one spin at time), but if user do an "energic spin" updatePickerTwoValues is called multiple time in a short time. There's a way to intercept when picker stop spinning, so only when spin stop, i can update pickerTwo values?