Hi, try this:
...
public float getNumber() {
mInteger.clearFocus();
mDecimal.clearFocus();
float v = mInteger.getValue() +
((float)mDecimal.getValue())/10;
return v;
}
the clearfocus might solve it
On Wednesday, July 27, 2011 9:52:12 PM UTC-3, Frank wrote:
>
> Hi all,
>
> I have a very weird problem from NumberPicker. The values input
> through the keyboard is not recognized but the values input by the
> "+/-" buttons are. The following is the source code.
>
> public class NumberPickerDlg extends AlertDialog {
> private NumberPicker mInteger;
> private NumberPicker mDecimal;
> public NumberPickerDlg(Context context, float val) {
> ...
> }
>
> public float getNumber() {
> float v = mInteger.getValue() +
> ((float)mDecimal.getValue())/10;
> return v;
> }
> }
>
> //the following is how it is used.
>
> final NumberPickerDlg d = new NumberPickerDlg(...);
> d.setButton("OK", new DialogInterface.OnClickListener() {
> public void onClick(DialogInterface dialog, int which) {
> float val = d.getNumber();
> }
> });
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en