android webView loading finished but it was a blank only I touch the screen can the content show Idont know why?and how it happened

Posted by Sunday on Stack Overflow See other posts from Stack Overflow or by Sunday
Published on 2013-11-01T03:18:18Z Indexed on 2013/11/01 3:54 UTC
Read the original article Hit count: 162

Filed under:
|
|
|
|

when my webView load this page , it was blank-page or white page only I touch the screen the content can only show

    private WebView webview;
    private ProgressDialog mProgressDialog;
    private Context mContext;
    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_web);
    mContext = this;
    webview = (WebView)findViewById(R.id.myWebView);
    String url = (String)getIntent().getExtras().get("url");
    webview.getSettings().setJavaScriptEnabled(true);
    webview.setWebViewClient(new MyWebViewClient());
    if(url!=null){
        webview.loadUrl(url);
    }
}
class MyWebViewClient extends WebViewClient {
    @Override
    public void onPageStarted(WebView view, String url, Bitmap favicon) {
        super.onPageStarted(view, url, favicon);
        mProgressDialog = ProgressDialog.show(mContext, "tips", "wate···the view is loading", true, false);
    }

    @Override
    public void onPageFinished(WebView view, String url) {
        mProgressDialog.dismiss();
        super.onPageFinished(view, url);
    }
}

© Stack Overflow or respective owner

Related posts about android

Related posts about webview