Android Question How to refresh Webview1 when my Webview1 unfinished completed

Ajws

Member
Licensed User
Hi, i have a problem to refreshing my webview1 when webview unfinished completed, can you help me...
?

Sub WebView1_PageFinished (Url As String)
UrlTemp = WebView1.Url

End Sub


Sub Refresh_Click
WebView1.LoadUrl(UrlTemp)

End Sub
 

Ajws

Member
Licensed User

sory, i'm newbie... can you give me example how to use
ProgressChanged2(WebView1 AsWebView, NewProgress As Int) ???
 
Upvote 0

ronell

Well-Known Member
Licensed User
Longtime User
ProgressChanged(NewProgress As Int) event sample
B4X:
Sub Activity_Create(FirstTime As Boolean)

webview.Initialize("webview")

Activity.AddView(webview, 0, 0, 100%x, 100%y)

    webviewextras1.Initialize(webview)

    Dim WebChromeClient1 As DefaultWebChromeClient
    WebChromeClient1.Initialize("progress")
    webviewextras1.SetWebChromeClient(WebChromeClient1)





    Dim WebViewClient1 As DefaultWebViewClient
    WebViewClient1.Initialize("WebViewClient1")

    webviewextras1.SetWebViewClient(WebViewClient1)
        
    


    webviewextras1.LoadUrl(url)

    Dim progresslbl As Label
    Dim Percentage As ProgressBar


    Percentage.Initialize("")
                    Percentage.Progress = 0
                    Percentage.Color = Colors.Black
                    Activity.AddView(Percentage, 0dip, 50%y, 100%x, 30dip)


    progresslbl.Initialize("")
                    Activity.AddView(progresslbl,50%x,Percentage.Top,50%x,40dip)
                    progresslbl.SetLayout(50%x - progresslbl.Width/2,50%y,50%x,40dip)
                    progresslbl.Gravity = Gravity.CENTER_HORIZONTAL
                    progresslbl.Text = "Please Wait..."

End Sub

Sub progress_ProgressChanged(NewProgress As Int)

    Log("WebView1 loading progress: "&NewProgress&"%")


    Percentage.Progress = NewProgress
            
    If NewProgress = 100 Then
        progresslbl.Visible = False
        Percentage.Visible = False
   
    
    End If
    Log(webview.Url)
End Sub
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…