Sub Globals
Private WebView1 As WebView
Private WVExtras As WebViewExtras
Dim JS As DefaultJavascriptInterface
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("layMain")
WebView1.JavaScriptEnabled = True
WVExtras.Initialize(WebView1)
WVExtras.JavaScriptEnabled = True
JS.Initialize
WVExtras.AddJavascriptInterface(JS, "B4A")
End Sub
Sub Activity_Resume
WebView1.LoadUrl("https://www.lottomaticaitalia.it/it/prodotti/lotto")
End Sub
Sub WebView1_PageFinished (Url As String)
Dim script As String
script = "B4A.CallSub('ProcessHTML', true, document.documentElement.outerHTML)"
WVExtras.ExecuteJavascript(script)
End Sub
Sub ProcessHTML(Html As String)
Dim match As Matcher = Regex.Matcher("<tbody>(.*?)<\/tbody>", Html.Replace(CRLF,""))
match.Find
Dim tbody As String = match.Group(1).Trim
Msgbox(tbody,"")
End Sub