Android Question How to set up a refresh of the webview?

winjiadh

Active Member
Licensed User
Longtime User
According to the forum tutorial, I set up a panel, put a webview and a button (btClose) in the middle, when I ran it, I didn't know how to set the refresh of the webview, I only had to clear the cache of the app, I didn't know if the webview had a refresh function
B4X:
Sub Globals
    Private pnlWeb As B4XView
    Private WebView1 As WebView
End Sub
Private Sub adButton_Click
    pnlWeb.LoadLayout("web")
    If pnlWeb.Visible Then pnlWeb.Visible=False Else pnlWeb.Visible=True
    WebView1.Invalidate
    WebView1.LoadUrl("https://www.b4x.com/teach.html")
End Sub

Private Sub btClose_Click
    pnlWeb.Visible=False
    WebView1.RemoveView
End Sub
 

Justcooldev

Member
Licensed User
hi,

you can use this line :

B4X:
WebView1.LoadUrl(WebView1.Url)
 
Upvote 0

winjiadh

Active Member
Licensed User
Longtime User
hi,

you can use this line :

B4X:
WebView1.LoadUrl(WebView1.Url)
However, if the content of the HTML page changes, the WebView in the app is still not refreshed, and the WebView can only be refreshed with the WebViewSettings library
like this
wvs.setCacheMode(wv,"LOAD_NO_CACHE")
the HTML page will refreshed in WebView
 
Upvote 0

Justcooldev

Member
Licensed User
are you sure, because, it is working with me,
if you are sure, then you will be obligated to use wvs.setCacheMode(wv,"LOAD_NO_CACHE")
 
Upvote 0
Top