Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You can try to extend WebChromeClient, override <code>onProgressChanged(WebView view, int newProgress)</code> and register it on your WebView with <code>setWebChromeClient(WebChromeClient)</code> method. This will free your application from the additional thread that you are starting just to check whether progress changed. Use the callback, it is simpler. So that would be the first thing.</p> <p>Another one is that I was also experimenting with this progress status and I came to some conclusions about how it behaves:</p> <ul> <li>for some use cases (such as check if page is even under the given url) it has to be greater then 10. When WebView makes the connection to the url provided then it automatically sets the progress value to 10 even if it did not make a successful connection, if it is greater then 10, then you can be sure that url could be accessed and the loading has begun,</li> <li>progress will be returned as 100% when you call <code>stopLoading()</code> on your WebView, </li> <li>keeping previous point in mind also when WebView won't be able to load the full site (it will get a timeout for an image for example) then it will report that page was fully loaded (100%)</li> </ul> <p>To sum up, this progress bar is an indicator on whether WebView has finished loading the site or not but in terms of WebKit not in terms of page being completely downloaded. You have to keep in mind that connection may crash, resources (images, css, js) may not load for some reason, JavaScript can load some more resources when page will finish up loading etc. this progress can't tell you if the sites content was fully loaded or not, it tells you that WebView thinks that this should be all.</p> <p>I have no other ideas on how to check whether page was fully loaded or not, I think this is the only way.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload