Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim WebViewExtras1 As WebViewExtras
Dim WebView1 As WebView
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("layoutMain")
' add the B4A javascript interface to the WebView
WebViewExtras1.addJavascriptInterface(WebView1, "B4A")
' now load a web page
WebView1.LoadUrl("http://www.lfv-tirol.at/service/aktuelle-alarmierungen.html")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub WebView1_PageFinished (Url As String)
' Now that the web page has loaded we can get the page content as a String
' see the documentation http://www.b4x.com/forum/additional-libraries-classes-official-updates/12453-webviewextras.html#post70053 for details of the second parameter callUIThread
Dim Javascript As String
Javascript="B4A.CallSub('ProcessHTML', false, document.documentElement.outerHTML)"
'Log("PageFinished: "&Javascript)
WebViewExtras1.executeJavascript(WebView1, Javascript)
End Sub
Sub ProcessHTML(Html As String)
Dim objMatch As Matcher
Dim arrLinks As String
arrLinks = ""
' Match expression to HTML
objMatch = Regex.Matcher("Lienz", Html)
' Loop through matches and add <1> to List
Do While objMatch.find()
Log(objMatch.Group(1))
Loop
'Msgbox2(strMatch,"Letzter Alarm","Ok","Cancel","No",Null)
End Sub