When I click on the link the following code runs (my WebView is named wvSession):
B4X:
Sub wvSession_OverrideUrl (Url As String) As Boolean
If (Url.IndexOf("reload:") > -1) Then
Dim id As String = Url.SubString2(7, Url.Length)
Log("id: " & id)
ReloadSession(id)
Return(True)
End If
End Sub
Sub ReloadSession(id As String)
Dim slst As List
slst = File.ReadList(File.DirDefaultExternal, "Sessions.txt")
For Each s1 As String In slst
If ((s1.Contains("<!--")) And (s1.Contains(id))) Then
Log("found id: " & s1)
End If
Next
End Sub
I am looking for an html comment line that contains the "id" in the file Sessions.txt.
I dynamically generate a "session" and append it to a file called Sessions.txt. Each "session" is an exercise session. The session block contains parameters such as ID, duration, laps, and time, plus I repeat the parameters in an HTML comment comma separated string that can later be restored to the screen display to remind me of that exercise session. I restore the session by clicking the dynamically generated link (containing the session ID) that is saved as part of the session block.