J2ME TextField Exception
Posted
by Bob
on Stack Overflow
See other posts from Stack Overflow
or by Bob
Published on 2009-06-30T16:48:13Z
Indexed on
2010/03/16
23:51 UTC
Read the original article
Hit count: 332
When I instantiate a textField, I have a number in it that I want to be the default text. The problem is, I can't seem to be able to place that value into the textfield without getting an error. The strange thing about it is that the same TextField is what I use to set the value of the variable containing the number.
TextField myTF = new TextField("Number", value, 10, TextField.NUMERIC);
When I run this code, I receive an exception stating that value doesn't match the constraints of TextField.NUMERIC. However, when I check the vale of the value of the variable, I get the following output:
value = 1234567890
value.length() = 10
The value is set by the same TextField, saved to the phone that I am working on, and when loaded from the phone's settings, throws an exception.
© Stack Overflow or respective owner