0

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?

timemanx
  • 4,493
  • 6
  • 34
  • 43

1 Answers1

0

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);
    }
});
henry4343
  • 3,871
  • 5
  • 22
  • 30
  • I'm making the webview invisible in `onPageStarted()` & visible again in `onPageFinished()`. The problem I'm facing is that on making the `WebView` visible in `onPageFinished()`, it shows the previous page for a few moments before changing to the new page. What I need to know is when the `WebView` is done rendering the new page. – timemanx Jan 03 '14 at 12:46