Check when WebView finished loading

Check if a WebView finished loading via WebViewClient in Android.


Libraries

Code Snippet
yourWebView.setWebViewClient(new WebViewClient() {

    // Will fire when the website finished loading.
    @Override
    public void onPageFinished(WebView view, String url) {
        // Do your stuff here
    }
});


Implementation

A little example:<code>WebView myWebView = (WebView) findViewById(R.id.webView); myWebView.setWebViewClient(new WebViewClient() { @Override public void onPageFinished(WebView view, String url) { System.out.println("Website " + url + " was loaded successfully!"); // Only for test purposes } }); myWebView("https://www.google.com");</code>





Comments
  • mode_editWrite a comment



  • forumComments




Embed Code

We provide special containers which include the full snippet and a link to this site. So for example when you make a tutorial and you are using code from this site, you can use one of the following snippet embeddings:

Load Preview Get Code Close Preview







    Share
    Rating
    thumb_up 0 thumb_down
    Author
    Thorolus

    I'm the head developer and co-founder of GlovilGames Studios (glovilgames.com) and other platforms GlovilGames created, like vsnippets.com, worth-calculator.net, python-obfuscator.com and some mobile apps and games.

    Tags
    Android
    WebView



    Informations

    posted on 2016-09-25 13:06:27

    viewed 139 times

    snippet's UUID is 57e7afb300d2e

    Similar Snippets