WebView changes pages some moments after onPageFinished()

266 Views Asked by At

I'm changing the WebView's visibility to visible when onPageFinished() is called but the previous page is visible for a few moments before the WebView renders the new page.

Is there any way to catch the page rendering done event of the WebView?

1

There are 1 best solutions below

1
On

You can detect webview start and finish on setWebViewclient

webView.setWebViewClient(new WebViewClient(){
    @Override
    public void onPageStarted(WebView view, String url, Bitmap favicon) {
        // TODO Auto-generated method stub
        super.onPageStarted(view, url, favicon);
    }

    @Override
    public void onPageFinished(WebView view, String url) {
        // TODO Auto-generated method stub
        super.onPageFinished(view, url);
    }

    @Override
    public void onReceivedError(WebView view, int errorCode,String description, String failingUrl) {
        // TODO Auto-generated method stub
        super.onReceivedError(view, errorCode, description, failingUrl);
    }

    @Override
    public void onReceivedLoginRequest(WebView view, String realm,
                    String account, String args) {
        // TODO Auto-generated method stub
        super.onReceivedLoginRequest(view, realm, account, args);
    }
});