Stack Overflow archive
1 scoreaccepted

load url in webview with asynch task fails

score
1
question views
623
license
CC BY-SA 3.0

You should not be loading a WebView in a background thread; it needs to be loaded on the UI thread.

I would add a listener to your WebView and when the URL is finished loading you can add your button.

java
yourWebView.setWebViewClient(new WebViewClient() {

   public void onPageFinished(WebView view, String url) {
        // add your button here
    } 
}); 

yourWebView.loadUrl(url);

Originally posted on Stack Overflow. Public user contributions are licensed under Creative Commons Attribution-ShareAlike.