Android Question Help with converting one line of code to B4A from VB

Beja

Expert
Licensed User
Longtime User
In VB it's in several lines..

VB code:
B4X:
Private Sub Command1_Click()
Dim a(0 To 7) As Byte
a(0) = "83"
a(1) = "68"
a(2) = "82"
a(3) = "127"
a(4) = "127"
a(5) = "0"
a(6) = "0"
a(7) = "254"

MSComm1.Output = a

Thanks in advance

Edit:
It will be sent from Android device by Bluetooth.
 
Last edited:

JohnC

Expert
Licensed User
Longtime User
Dim Array() As String = Array As String(83, 68, 82, 127, 127, 0, 0, 254)

Then when you read a value, convert to byte.

There might be a way to setup the array as a byte array directly, but I can't think of right now.
 
Upvote 0

Beja

Expert
Licensed User
Longtime User
Dim Array() As String = Array As String(83, 68, 82, 127, 127, 0, 0, 254)

Then when you read a value, convert to byte.

There might be a way to setup the array as a byte array directly, but I can't think of right now.

Thanks John
This code is not working:
I just stepped our and will be back soon.

B4X:
Dim Array() As String = Array As String(83, 68, 82, 127, 127, 0, 0, 254)
Stream.Write(Array)

Any meaning?
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
Dim Array() As String = Array As String(83, 68, 82, 127, 127, 0, 0, 254)
There might be a way to setup the array as a byte array directly, but I can't think of right now.
šŸ˜Æ
Dim arrBytes() As Byte = Array As Byte(83, 68, 82, 127, 127, 0, 0, 254)

You cannot use Array as variable name, it is a language keyword, of course.
 
Upvote 0
Top