Android Question Invalid double

mitobobo

Member
Licensed User
Longtime User
Hello everybody!

I need your help, please :(

I have the following code:
B4X:
Sub baccedi_Click

Dim UsernameVariabile As String
Dim PasswordVariabile As String

UsernameVariabile = fusername.Text 'From an EditText
PasswordVariabile = fpassword.Text  'From an EditText
  Dim job1 As HttpJob
  'Send a POST request
  job1.Initialize("Check", Me)
  job1.PostString("http://test.website.org/login.php", "username="+UsernameVariabile +"&pw="+PasswordVariabile)
   
End Sub

which returns the below error:
java.lang.NumberFormatException: "Invalid double:"username=". I really can't understand why...

Thank you so much in advance for your help.
 

NJDude

Expert
Licensed User
Longtime User
To concatenate you have to use the & not the + sign, the line should be like this:
B4X:
job1.PostString("http://test.website.org/login.php", "username=" & UsernameVariabile & "&pw=" & PasswordVariabile)
 
Upvote 0

mitobobo

Member
Licensed User
Longtime User
To concatenate you have to use the & not the + sign, the line should be like this:
B4X:
job1.PostString("http://test.website.org/login.php", "username=" & UsernameVariabile & "&pw=" & PasswordVariabile)
Stupid me! Haven't been using B4A since a while... Thank you so much for your help and time, NJDude!:):)
 
Upvote 0
Top