Android Question Webview PageFinished event not firing in code module

Jakes72

Active Member
Licensed User
Longtime User
Hi Gurus,

I have set a Webview control on one of my forms to navigate to a URL from within a code module, the code runs through with no errors and the URL is displayed as it should, but the 'PageFinished' event never fires. I am calling the code in the code module from my Main Activity. Any idea what I am doing wrong? Please help!

This is my code in the code module:
B4X:
Public Sub NavigateToGoogle()

    'Load the parent form containing my Webview control.
    MainActivity_.RemoveAllViews
    MainActivity_.LoadLayout(strWebBrowserParentForm_)
    
        
    WebBrowser.Initialize("WebBrowser")           'WebBrowser is declared in Class_Globals in the code module like this:   Private WebBrowser As WebView
    WebBrowser = MainActivity_.GetView(0)      'Get my Webview control.
    
  
    'Make sure the Webview control is set at 100%
    Dim Obj1 As Reflector
    Obj1.Target = WebBrowser
    Obj1.RunMethod2("setInitialScale", "100", "java.lang.int")


    WebBrowser.LoadUrl("http://www.google.com")


End Sub


Public Sub WebBrowser_PageFinished (Url As String)

      '...................this never fires!!!!

End Sub
 

DonManfred

Expert
Licensed User
Longtime User
to navigate to a URL from within a code module, the code runs through with no errors and the URL is displayed as it should, but the 'PageFinished' event never fires
That is not an error. Code modules can not raise any Event.
 
Upvote 0

Jakes72

Active Member
Licensed User
Longtime User
Never mind Don I solved the problem, it was because the event inside the class module would only fire if the prefix for the event name (in the class module) was the same as the name I had declared the webview as in the main activity.
 
Upvote 0
Top