WebView does not show new page on when user change data connection

viljemto

Member
Licensed User
Longtime User
Hi,

I have some strange problem. Lets say, the device is connected to wifi I can load page with WebView1.LoadUrl().

If I swicth to 3G, it does not refresh page on click refresh button, but WebView1_PageFinished() is called.

When I switch back to wifi, page is loaded on refresh.

3G is working. If app is installed again and started in 3G is working and when I switch to wifi, again it is not working.

Any idea?

Thanks, With regards.
 

viljemto

Member
Licensed User
Longtime User
Hi,

I just load new url - WebView1.LoadUrl(url)

I have noticed, that the same problem is if web page has url link and the user clicks on it.
 
Upvote 0

Shaun

Member
Licensed User
Longtime User
I found a simple solution for this that works.

B4X:
Sub Process_Globals
'I load the default page here
    Dim URLstring As String = "Http://www.google.com"
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("Layout1")
    MyWebView.LoadUrl(URLstring)
End Sub

'Grab the latest URL
Sub MyWebView_PageFinished (URL As String)
    URLstring = URL
End Sub

'even though I use a layout, I reinitialize the webview
'Upon switching back and forth between 3g and wireless
'I refresh and it reconnects nicely
Sub RefreshButton_Click
    MyWebView.Initialize("MyWebView")
    MyWebView.LoadUrl(URLstring)
End Sub

Hope this helps anyone else with the same issue!
 
Last edited:
Upvote 0
Top