I have implemented WebView in Dialog Activity and I am loading simple url into webview.
my Webview settings are as
wbView = (WebView) findViewById(R.id.wbView);
wbView.setKeepScreenOn(true);
wbView.getSettings().setJavaScriptEnabled(true);
wbView.getSettings().setDomStorageEnabled(true);
wbView.getSettings().setBuiltInZoomControls(true);
wbView.setInitialScale(100);
// wbView.getSettings().setUseWideViewPort(true);
wbView.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_OVERLAY);
wbView.setWebViewClient(new MyWebViewClient());
and MyWebViewClient() contains
private class MyWebViewClient extends WebViewClient {
@Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
prgBar.setVisibility(View.GONE);
}
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler,
SslError error) {
Log.e("Error VAGARO", error.toString());
prgBar.setVisibility(View.GONE);
handler.proceed();
}
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return false;
}
}
I am loading two HTML files from the Asset in the same webview its working fine but unable to load dynamic url.
I Google and find some posts on http://code.google.com/p/android/issues/detail?id=21177
My logcat shows me
05-09 13:33:30.187: W/webcore(20054): java.lang.Throwable: EventHub.removeMessages(int what = 107) is not supported before the WebViewCore is set up.
05-09 13:33:30.187: W/webcore(20054): at android.webkit.WebViewCore$EventHub.removeMessages(WebViewCore.java:1683)
05-09 13:33:30.187: W/webcore(20054): at android.webkit.WebViewCore$EventHub.access$7900(WebViewCore.java:926)
05-09 13:33:30.187: W/webcore(20054): at android.webkit.WebViewCore.removeMessages(WebViewCore.java:1795)
05-09 13:33:30.187: W/webcore(20054): at android.webkit.WebView.sendOurVisibleRect(WebView.java:2917)
05-09 13:33:30.187: W/webcore(20054): at android.webkit.ZoomManager.setZoomScale(ZoomManager.java:593)
05-09 13:33:30.187: W/webcore(20054): at android.webkit.ZoomManager.access$1700(ZoomManager.java:49)
05-09 13:33:30.187: W/webcore(20054): at android.webkit.ZoomManager$PostScale.run(ZoomManager.java:984)
05-09 13:33:30.187: W/webcore(20054): at android.os.Handler.handleCallback(Handler.java:605)
05-09 13:33:30.187: W/webcore(20054): at android.os.Handler.dispatchMessage(Handler.java:92)
05-09 13:33:30.187: W/webcore(20054): at android.os.Looper.loop(Looper.java:137)
05-09 13:33:30.187: W/webcore(20054): at android.app.ActivityThread.main(ActivityThread.java:4424)
05-09 13:33:30.187: W/webcore(20054): at java.lang.reflect.Method.invokeNative(Native Method)
05-09 13:33:30.187: W/webcore(20054): at java.lang.reflect.Method.invoke(Method.java:511)
05-09 13:33:30.187: W/webcore(20054): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
05-09 13:33:30.187: W/webcore(20054): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
05-09 13:33:30.187: W/webcore(20054): at dalvik.system.NativeStart.main(Native Method)
Suggest me the change that I should make.
Update
I found that if I'll pass any url like "www.facebook.com" then its giving me this error, but if I'll replace it with "https://www.facebook.com" then its working fine.
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
The issue I found was because of the url without
http://
orhttps://
. So I appended this tag if the url doesn't containshttp://
orhttps://
.In my case, I fixed it by changing the order. I put the loadUrl before getSettings()
Working snippet below,
Hope this helps someone..
I have the same problem after I called
finish()
and restart the sameActivity
. Therefore, maybe it cannot simply finish the activity with aWebView
. I did the following before finish the activity and it works.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
The Queue
mMessages
has to be NULL to avoid the Exception.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 callingsetContentView()
. How long you can wait I couldn't figure out. So those two will be the first lines inonCreate()
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.