Hallo , I changes the Astreams to AST,
But there is a mistake
where did the error come from, is there a solution?
thank you
But there is a mistake
B4X:
Sub Process_Globals
Private ast As AsyncStreamsText
End Sub
Sub Serial1_Connected (Success As Boolean)
If Success Then
ToastMessageShow("Connection Successfully", False)
ast.Initialize(Me, "ast",Serial1.InputStream, Serial1.OutputStream)
'AStreams.Initialize(Serial1.InputStream, Serial1.OutputStream, "AStreams")
connected = True
vib.Vibrate (100)
RemoveViews
Activity.LoadLayout("1")
Else
connected = False
Msgbox("BT Not found ", "Error Connecting")
vib.Vibrate (60)
End If
End Sub
Sub mnudisconnect_click
vib.Vibrate(60)
connected = False:ast.Close:Serial1.Disconnect 'connected = False:AStreams.Close:Serial1.Disconnect
ToastMessageShow("Disconnecting Successfully", False)
End Sub
Sub Activity_Pause (UserClosed As Boolean)
If UserClosed Then
ast.Close ' AStreams.Close
Serial1.Disconnect
End If
End Sub
Sub AStreams_NewData (Buffer() As Byte) 'Sub AStreams_NewData (Buffer() As Byte)
Dim bc As ByteConverter
Dim msg As String = bc.StringFromBytes(Buffer, "UTF8")
Log("msg = " & msg.Length & " [" & msg & "]")
Dim EqualsAt As Int = msg.IndexOf("=") 'INI
If EqualsAt < 0 Then
Log("invalid setting line: " & msg)
Else
Dim SettingId As String = msg.SubString2(0, EqualsAt)
Dim SettingValue As String = msg.SubString(EqualsAt + 1)
Select Case SettingId
Case "s1"
Label1.Text = SettingValue
Case "s2"
Label2.Text = SettingValue
Case "s3"
Label4.Text = SettingValue
End Select
End If
End Sub
Sub sent_data
If connected Then
If ast.IsInitialized = False Then :Return:End If 'If AStreams.IsInitialized = False Then :Return:End If
Dim buffer() As Byte
buffer = data_button.GetBytes("UTF8")
ast.Write(buffer) ' AStreams.Write(buffer)
End If
getar.Vibrate (50)
End Sub
B4X:
Generating R file. (0.00s)
Compiling generated Java code. Error
B4A line: 285
ast.Write(buffer) ' AStreams.Write(buffer)
javac 1.8.0_221
src\axc\P\main.java:1430: error: no suitable method found for NumberToString(byte[])
_ast._write /*String*/ (BA.NumberToString(_buffer));
^
method BA.NumberToString(double) is not applicable
(argument mismatch; byte[] cannot be converted to double)
method BA.NumberToString(float) is not applicable
(argument mismatch; byte[] cannot be converted to float)
method BA.NumberToString(int) is not applicable
(argument mismatch; byte[] cannot be converted to int)
method BA.NumberToString(long) is not applicable
(argument mismatch; byte[] cannot be converted to long)
method BA.NumberToString(Number) is not applicable
(argument mismatch; byte[] cannot be converted to Number)
1 error
where did the error come from, is there a solution?
thank you