How do i make my progress dialog dismiss after webview is loaded?

后端 未结 6 1444
一向
一向 2020-12-10 17:22

What do I need to my code to make the dialog dismiss() after the webview is loaded?

public void onCreate(Bundle savedInstanceState) { 
                  


        
6条回答
  •  时光说笑
    2020-12-10 18:13

    :o webview.setWebViewClient(new homeClient()); homeClient()????

    try this

    ...
    ...
    ...
    
    webview = (WebView) findViewById(R.id.webview);
    webview.setWebViewClient(new WebViewClient() {
                public boolean shouldOverrideUrlLoading(WebView view, String url) {              
                    view.loadUrl(url);
                    return true;
                }
    
    
              public void onPageFinished(WebView view, String url) {
                    if (progressBar.isShowing()) {
                        progressBar.dismiss();
                    }
                }
     webview.loadUrl("http://www.google.com");
    
    }
    

    Update:: this is a good example.

    Android WebView and the Indeterminant Progress Solution

提交回复
热议问题