Hello,
after a long time without b4a i start a new project.
As start point i use the "Bluetooth.zip" from https://www.b4x.com/android/forum/threads/android-bluetooth-bluetoothadmin-tutorial.14768/
The original works fine.
But when i change the "Sub btnSend_Click" to:
I get the Error: "java.lang.ArrayIndexOutOfBound sException: length=0; index=0"
There is no different in using .Write or .Write2
What i am doing wrong?
Best regards
Bernd
after a long time without b4a i start a new project.
As start point i use the "Bluetooth.zip" from https://www.b4x.com/android/forum/threads/android-bluetooth-bluetoothadmin-tutorial.14768/
The original works fine.
But when i change the "Sub btnSend_Click" to:
B4X:
Sub btnSend_Click
'AStream.Write(txtInput.Text.GetBytes("UTF8"))
If AStream.IsInitialized = False Then Return
Dim buffer() As Byte
'buffer = EditText1.Text.GetBytes("UTF8")
buffer(0) = 0x1b
buffer(1) = 0x40
buffer(2) = 0x00
'AStream.Write(buffer)
AStream.Write2(buffer,0,3)
txtInput.SelectAll
txtInput.RequestFocus
LogMessage("Me", txtInput.Text)
End Sub
I get the Error: "java.lang.ArrayIndexOutOfBound sException: length=0; index=0"
There is no different in using .Write or .Write2
What i am doing wrong?
Best regards
Bernd