michaelnovakjr/numberpicker — pull request #25 by andrewboissonnault (2013-07-12 02:31:34+00:00)
Title: NumberPickerDialog not picking up on NumberPicker EditText changes.

Fixed an issue where when the user changes the NumberPicker value using the keyboard and the EditText, then they pressed the set value button, the NumberPickerDialog was still calling onNumberSet with the old value. An explanation of the issue can be found [here](http://stackoverflow.com/questions/3691099/android-numberpicker-not-saving-edittext-changes).

From Stack Overflow
Question
>I have copied Android's NumberPicker widget to my own application, but I'm having one problem...
>
>When someone manually clicks the EditText and changes it via the keyboard, the selection is not saved. Is >there some listener that I can implement to check and see if the user manually changes the EditText to set it >as current? Or something?

Answer
>I found this solution lost somewhere in android-developers google group:
>
>For android SDK NumberPicker widget, simply use:
>
>myNumberPicker.clearFocus();
>
>before you try to get its value. When you have an activity with only the NumberPicker and maybe a button or a spinner, and you edit it and try to click elsewhere, its onFocusChangedListener is not handled properly. So you just need to force it to lost focus before using getValue(). Worked like a charm to me.