Is it possible to read string from text file every moment, without TextReader and Timer ?
Is it possible with AsyncStreamsText class ?
Now my code looks like:
B4X:
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("1")
tmr.Initialize("time",500)
tmr.Enabled = True
textreader1.Initialize(File.OpenInput("/dev/","ttyMT2"))
End Sub
Sub time_tick
Dim line As String
line = textreader1.ReadLine
Do While line <> Null
Log(line)
edittext2.Text = line
Loop
End Sub
Hi, you didn't mention if the above code is working..
If it is working then case closed.. just have your criteria and compare it to the text line each time.. if match then stop the iteration and disable timer.
you better disable the timer in the _tick event and enable it again before the end sub or you'll end up with a pile of tasks running and worst case ending up with stack overflow like errors.