write from AStream

Electrocutioner

Member
Licensed User
Longtime User
The following code gives Cannot cast type error:
Please help thanks!


Sub btnON_Click
Dim buffer As String
buffer="test"
AStream.Write(buffer)
End Sub
 

merlin2049er

Well-Known Member
Licensed User
Longtime User
Nice example. If your sending strings to another android device, how would the other side know what to do with it?

I guess I can use prefix before the actual string.

if you want to send label1.text = "something" and show up on the other android device as label1.text= "something"

B4X:
dim label1 asString
label1 = "label1" & label1.text Dim buffer() AsByte
buffer=label1.GetBytes("UTF8")
AStream.Write(buffer)

on the other end when you receive the string check the prefix to know where it goes, then strip the prefix.
 
Upvote 0
Top