Android Question IsNaN Java error

MitchBu

Well-Known Member
Licensed User
Longtime User
I need to validate that the data entered is a number before storing it.

I found this in the forum :
B4X:
Sub IsNan(d As Double) As Boolean
   Return d <> d
End Sub

Problem is, when I call it with this :
B4X:
Log("isnan: " & IsNan(EtRouting.Text)) ' contains "ƽƾƿǀ"

I get this Java error :

Error occurred on line: 286 (Main)
java.lang.NumberFormatException: For input string: "ƽƾƿǀ"
at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2043)
at sun.misc.FloatingDecimal.parseDouble(FloatingDecimal.java:110)
at java.lang.Double.parseDouble(Double.java:539)
at anywheresoftware.b4a.debug.RDebugUtils.numberCast(RDebugUtils.java:58)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:348)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:180)
at anywheresoftware.b4a.debug.Debug.delegate(Debug.java:262)
at com.bujardet.checkprinter.main._initedittexts(main.java:914)
at com.bujardet.checkprinter.main._activity_create(main.java:612)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
 
Top