i use this code receive text from a usb serial device ,it is a WIFI ROUTER.
Private Sub serial_DataAvailable (Buffer() As Byte)
Dim hexf As String
hexf=bc.HEXFromBytes(Buffer)
'Log(bc.StringFromBytes(Buffer,"utf8"))
LogMessage(BytesToString(Buffer, 0, Buffer.Length, "UTF8"),hexf)
End Sub
Sub LogMessage(Msg As String,hexf As String)
Label1.Text = Label1.Text& Msg
If hexf="0A" Then 'OA is new line symbol, in HEX code
WebView.LoadHtml ("<html> <body>" & Label1.Text & "</ body> </ html>")
End If
End Sub
i use this library :
https://www.b4x.com/android/forum/threads/felusbserial-alternative-usb-serial-library.62216/
"Sub serial_DataAvailable (Buffer() As Byte) " only can get 1 character 1 time,it is text stream.
so i need connect these character together.
"Label1.Text = Label1.Text& Msg"
after display it in webview.
maybe because data from the router is too many. maybe 5000 LINE.
app only can display first about 100 lines ,after stoped.screen cannot touch.app die.
how to display this text stream is better ? i have try ,only use edittext or label.text, it is same.cannot display more data.i want make a app same to Hyper Terminal in window system.
this code make app jammed shut,screen stoped.and webview cannot auto scoll to bottom
some time after long time jammed shut,the app can display all data.
this is my app source