Android Question help using putstring

Chris Guanzon

Active Member
Licensed User
Longtime User
Can anyone help me how to use putstring with many parameters?

here's my code:
B4X:
Connection.PutString(URL & Path, Array As String("old_password", EditText1.Text, "password", EditText2.Text, _
            "password_confirmation", EditText3.Text))

i am not sure if this is correct.
 

Chris Guanzon

Active Member
Licensed User
Longtime User
Connection is httpjob.

This is the error


is the code i posted correct? i am trying to update the password using PUT. But i can't pass the parameters needed.
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
are you sure server accepts a PUT? and even if it did, what you're PUTting, isn't what PUT does.
 
Last edited:
Upvote 0

Chris Guanzon

Active Member
Licensed User
Longtime User
are you sure server accepts a PUT? and even if it did, what you're PUTting, isn't what PUT does.

Yes, it does. i wanna know if my code is correct or i am missing something because it has yellow underline in my code. the error is posted in #3, a screenshot of the error.
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
you are not using PUT correctly. what you probably mean to use is POST. as far as the "error" is concerned, it's a "warning". it says warning. as far as the "object" mentioned is concerned, there is no way to know what it refers to, given what you've shared. sorry.
 
Upvote 0

Chris Guanzon

Active Member
Licensed User
Longtime User

What is the correct code to use PUTSTRING with multiple parameters? can you help me with this?
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
Upvote 0

Chris Guanzon

Active Member
Licensed User
Longtime User
I found the solutions:

B4X:
Dim m As Map

m.Initialize
m.Put("old_password", EditText1.Text)
m.Put("password", EditText2.Text)
m.Put("password_confirmation", EditText3.Text)

Dim jSONGen As JSONGenerator
jSONGen.Initialize(m)
Dim strJSONGen As String
strJSONGen = jSONGen.ToString

then

B4X:
Connection.PutString(URL & Path, strJSONGen)

Thanks for the reply and help.
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…