Android Question Problem with LoadURL inside OverrideURL

Discussion in 'Android Questions' started by CRoberts, Mar 5, 2015.

  1. CRoberts

    CRoberts New Member Licensed User


    I have multiple WebViews and I want to be able to click a record on the first one and open a different page in the second. In my example the second WebView is not updating. If I carry out the same instruction using a button then the second WebView does update.

    Am I missing something in my OverrideUrl event?

    Sub Activity_Create(FirstTime As Boolean)
    WebView1.LoadURL("file:///" & File.DirRootExternal & "\greatgainstrading\" & "Test.html")
    WebView2.LoadURL("file:///" & File.DirRootExternal & "\greatgainstrading\" & "Test.html")
    WebView3.LoadURL("file:///" & File.DirRootExternal & "\greatgainstrading\" & "FDL.html")
    End Sub

    Sub Button1_Click
    WebView2.LoadURL("file:///" & File.DirRootExternal & "\greatgainstrading\" & "FDL.html")
    End Sub
    Sub WebView1_OverrideUrl (Url As String) As Boolean
    WebView2.LoadURL("file:///" & File.DirRootExternal & "\greatgainstrading\" & "FDL.html")
    Return True
    End Sub
    Sub Button2_Click
    WebView2.LoadURL("file:///" & File.DirRootExternal & "\greatgainstrading\" & "test.html")
    End Sub


  2. KZero

    KZero Active Member Licensed User

    I tested your code with different URLs (google and yahoo) and it worked correctly.
    the error may be in the pages it self
  3. DonManfred

    DonManfred Expert Licensed User

    use lowercase filenames in assets

    Maybe the additional subfolder is the problem.
  4. Erel

    Erel Administrator Staff Member Licensed User

    Please use [code]code here...[/code] tags when posting code.

    You can always move out of the OverrideUrl event with CallSubDelayed.
  5. CRoberts

    CRoberts New Member Licensed User

    Thanks for looking at this. As you reported it working, I ran it again and discovered if I left it, after 30 seconds or thereabouts the second WebView changed its page. Since then it has changed immediately. The same thing, although with a longer delay occured on my Samsung S4 Mini phone. (Original testing was with a Samsung Galaxy Tab S)

    I must admit to being impatient and never left it 30 seconds without shutting down and trying something else when I was testing yesterday.

    Erel, thanks for your comments. I should have thought of CallSubDelayed.
  6. Reviewnow

    Reviewnow Active Member Licensed User

    I think you have an incorrect path your \ has to be the other direction /

    WebView1.LoadURL("file:///" & File.DirRootExternal & "/greatgainstrading/" & "Test.html")
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice