Android Question Problem with LoadURL inside OverrideURL

CRoberts

New Member
Licensed User
Hi,

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)
Activity.LoadLayout("main")
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

Thanks

Charles
 

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
 

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.
 

Reviewnow

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

B4X:
WebView1.LoadURL("file:///" & File.DirRootExternal & "/greatgainstrading/" & "Test.html")
 
Top