I have implemented WebView in Dialog Activity and I am loading simple url into webview.
my Webview settings are as
wbView = (WebView) findViewById(R
I have the same problem after I called finish()
and restart the same Activity
. Therefore, maybe it cannot simply finish the activity with a WebView
. I did the following before finish the activity and it works.
try{
webView.stopLoading();
ViewGroup parent = (ViewGroup)webView.getParent();
parent.removeView(webView);
webView.destroy();
}catch(Exception e){
Log.e(TAG, "clear webView fail");
e.printStackTrace();
}
finish();
The issue I found was because of the url without http://
or https://
. So I appended this tag if the url doesn't contains http://
or https://
.
The issue is generally related to the URL being pointed to not being found. It is a 404 (i.e. a URL that wasn't found). Modify the URL
In my case, I fixed it by changing the order. I put the loadUrl before getSettings()
Working snippet below,
mWebView = (WebView) findViewById(R.id.web_view);
// load file
mWebView.loadUrl(SERVER_URL);
mWebView.getSettings().setJavaScriptEnabled(true);
Hope this helps someone..
I've seen this stack sometimes during the last days in my LogCat, but until now it wasn't blocking my dev. But I suspect it's related to the struggling my WebView somtetimes does. It seems to be a Bug affecting not only us:
android.webkit.WebViewCore.removeMessages(int):void
1675 private synchronized void removeMessages(int what) {
1676 if (mBlockMessages) {
1677 return;
1678 }
1679 if (what == EventHub.WEBKIT_DRAW) {
1680 mDrawIsScheduled = false;
1681 }
1682 if (mMessages != null) {
1683 Throwable throwable = new Throwable(
1684 "EventHub.removeMessages(int what = " + what + ") is not supported " +
1685 "before the WebViewCore is set up.");
1686 Log.w(LOGTAG, Log.getStackTraceString(throwable));
1687 } else {
1688 mHandler.removeMessages(what);
1689 }
1690 }
The Queue mMessages
has to be NULL to avoid the Exception.
// Message queue for containing messages before the WebCore thread is ready.
So it's quite simple: something is causing the WebCore to need much more time to set up. According that 107 is `SET_SCROLL_OFFSET' and the stack-trace shows ZoomManger I will check if something in my code is causing the view to get active in some way while initiating the settings.
ANSWER:
This exception will be thrown if you call requestWindowFeature(Window.FEATURE_NO_TITLE)
and then wait too long for calling setContentView()
. How long you can wait I couldn't figure out. So those two will be the first lines in onCreate()
from now. Time will show me if I'm right.
The good news are that this warning tagged webcore
is only a warning and itself causes no impact to the rest of the app.
The bad news are that it seems that my problem has nothing to do with it and comes from somewhere other.