Wednesday, 7 August 2013

WebView must be loaded twice to load correctly

WebView must be loaded twice to load correctly

When the page with the WebView first loads, sometimes images are missing
or displayed incorrectly. If I reload the page the WebView always displays
perfectly. I know everyone will first think I set javascript after
loadUrl, but that isn't true.
In onCreate I have:
learnWebView = (WebView)findViewById(R.id.learnWebView);
learnWebView.setWebViewClient(new WebViewClient());
learnWebView.getSettings().setJavaScriptEnabled(true);
Then later in the function called after onCreate I have:
learnWebView.loadUrl("myurl");
And yes, I know that the function with loadUrl is called after onCreate
every time.

No comments:

Post a Comment