My activity has more than one webview. How do I determine which webview triggered the Page Finished event?
B4X:
Sub myWebview_PageFinished(Url As String)
Log("myWebview Attributes")
Log(Url) 'This is the right url
Log(myWebview) 'This is the wrong webview
End Sub
It looks like the standard approach only supplies the url. I want to also get the webview that triggered the event.
OK - so presumably you are initializing them both with the same event name - ie: .Initialize("myWebview")? If so, just use Sender to get the correct one:
B4X:
Sub myWebview_PageFinished(Url As String)
Private thisWebView as WebView = Sender
Log("myWebview Attributes")
Log(Url) 'This is the right url
Log(thisWebView) 'This is the webview that fired the PageFinished event.
End Sub
OK - so presumably you are initializing them both with the same event name - ie: .Initialize("myWebview")? If so, just use Sender to get the correct one:
B4X:
Sub myWebview_PageFinished(Url As String)
Private thisWebView as WebView = Sender
Log("myWebview Attributes")
Log(Url) 'This is the right url
Log(thisWebView) 'This is the webview that fired the PageFinished event.
End Sub