Hello,
I have 2 floatlabeledtextviews . Their keyboard types are : Numpad with decimal.
I use:
usd value is a double. So while i am typing to txttry txtother is also changing with each change. But if i use the decimal i get : java.lang.NumberFormatException: For input string: "14,"
I tried to change the , to . with a new code:
this time i get no error but decimals are not calculated (if i type 1 or 1.99 it always give the same result which it must not )
What is the correct way to fix it ?
TY
I have 2 floatlabeledtextviews . Their keyboard types are : Numpad with decimal.
I use:
B4X:
Sub txttry_TextChanged (OldText As String, NewText As String)
If NewText="" Then
txtother.Text=""
Else
txtother.Text=NewText/usd
End If
End Sub
usd value is a double. So while i am typing to txttry txtother is also changing with each change. But if i use the decimal i get : java.lang.NumberFormatException: For input string: "14,"
I tried to change the , to . with a new code:
B4X:
Sub txttry_TextChanged (OldText As String, NewText As String)
If NewText="" Then
txtother.Text=""
Else
If NewText.Contains(",") Then NewText.Replace(",",".")
txtother.Text=NewText/usd
End If
End Sub
this time i get no error but decimals are not calculated (if i type 1 or 1.99 it always give the same result which it must not )
What is the correct way to fix it ?
TY