Program stops with Error occurred on line: 257 (main). 257 is the sp.open(cmbport.value) line.
B4X:
Sub btnopen_MouseClicked (EventData As MouseEvent)
If btnopen.Text = "Open" Then
sp.Open(cmbport.Value)
sp.SetParams (BaudRate , DataBits , StopBits , Parity )
sp.PurgePort(8)
astream.Initialize(sp.GetInputStream, sp.GetOutputStream, "astream")
btnopen.text = "Close"
lblstatus.Text = "Status: Connected"
Else
AStream_Terminated
End If
End Sub