Search code examples
androidhttp-redirectwebviewload

android webview


HI all

I'm developing an application into that I want to redirect the current page to the next page after the webView has completely loading of the data.

How can I manage that?


Solution

  • You can add a WebViewClient to the WebView which has a callback method when a page is finished loading like this:

    webView.setWebViewClient(new WebViewClient() {
    
    @Override
    public void onPageFinished(WebView view, String url) {
        if(myFirstUrl.equals(url) {
            webView.loadUrl(mySecondUrl);
        }
    }});