I have a question concerning the Android NumberPicker
.
When the user is performing a Fling on a NumberPicker
, for every single step the Listener for OnValueChange
is triggered. Can I change this in that way, that the oldVal and the newVal can possibly differ by more than 1 from each other and the Listener is only triggered once?
Thanks in advance.
EDIT: I will try to explain it more specific in my code.
int diff = Math.abs(newVal - oldVal);
if (newVal - oldVal > 0) {
sendMessage(te);
for (int i = 0; i < diff; i++) {
sendMessage(plus);
}
sendMessage(te);
} else if (newVal - oldVal < 0) {
sendMessage(te);
for (int i = 0; i < diff; i++) {
sendMessage(minus);
}
sendMessage(te);
} else {
if (D)
Log.w(TAG, "This should NEVER happen");
}
This method is called inonValueChange. It sends the Messages too fast for my connected device to react in time. So I need to slow this down in any way. Does anyone has an idea how to slow it, without letting my main Thread sleep? When it is sleeping, the whole GUI is not responding during this time. I try to avoid this.
Thanks.