if val(Edittext1.text) < 3 then
' I'm lower then 3
else
' I'm greater then 2
end if
To check if Edittext1.text is really a number:
If IsNumber( Edittext1Text) Then .......
The Val() function will also do this for you but will return 0 if .Text is not a real number. So on EditText boxes controls it is best to check that what the user entered is
really a valid number not something else. Sometimes it best just to use a spinner control for numbers only.
Sub Globals
Dim EditText1 As EditText
End Sub
Sub Activity_Create(FirstTime As Boolean)
EditText1.Initialize("ET1")
Activity.AddView(EditText1, 50dip, 50dip, 100dip, 60dip)
End Sub
Sub ET1_TextChanged (Old As String, New As String)
Try
If EditText1.Text < 5 Then ToastMessageShow("Smaller", False)
Catch
Log(LastException.Message)
End Try
End Sub
There is no Val keyword in B4A. The compiler will automatically parse the string to a number. You can use IsNumber to test whether a string can be safely parsed as a number.