I want to trigger a function after webview’s finished loading a webpage and received no error. According to my experiment, the onPageFinished() will be triggered several times and in most of the cases, it will be executed before onReceivedError().
So how can I know that the webpage is loaded and no error is received?
You can set the
WebViewClientin theWebViewand Override its Callback methods which will let you know when the webpage has finished loading the page. For exampleHere
onPageFinished(WebView view, String url)will be called when webView has finished loading the current Page.Hope it helps 🙂