Webview的一些错误

今天在练习WebView这个控件的时候,出现了一些问题,输出日志打印了下面的错误

04-03 14:12:13.640: V/TabletStatusBar(1056): setLightsOn(true)
04-03 14:12:13.712: W/webcore(20618): java.lang.Throwable: EventHub.removeMessages(int what = 107) is not supported before the WebViewCore is set up.
04-03 14:12:13.712: W/webcore(20618):  at android.webkit.WebViewCore$EventHub.removeMessages(WebViewCore.java:1683)
04-03 14:12:13.712: W/webcore(20618):  at android.webkit.WebViewCore$EventHub.access$7900(WebViewCore.java:926)
04-03 14:12:13.712: W/webcore(20618):  at android.webkit.WebViewCore.removeMessages(WebViewCore.java:1795)
04-03 14:12:13.712: W/webcore(20618):  at android.webkit.WebView.sendOurVisibleRect(WebView.java:3081)
04-03 14:12:13.712: W/webcore(20618):  at android.webkit.ZoomManager.setZoomScale(ZoomManager.java:597)
04-03 14:12:13.712: W/webcore(20618):  at android.webkit.ZoomManager.access$1700(ZoomManager.java:49)
04-03 14:12:13.712: W/webcore(20618):  at android.webkit.ZoomManager$PostScale.run(ZoomManager.java:988)
04-03 14:12:13.712: W/webcore(20618):  at android.os.Handler.handleCallback(Handler.java:605)
04-03 14:12:13.712: W/webcore(20618):  at android.os.Handler.dispatchMessage(Handler.java:92)
04-03 14:12:13.712: W/webcore(20618):  at android.os.Looper.loop(Looper.java:137)
04-03 14:12:13.712: W/webcore(20618):  at android.app.ActivityThread.main(ActivityThread.java:4424)
04-03 14:12:13.712: W/webcore(20618):  at java.lang.reflect.Method.invokeNative(Native Method)
04-03 14:12:13.712: W/webcore(20618):  at java.lang.reflect.Method.invoke(Method.java:511)
04-03 14:12:13.712: W/webcore(20618):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:853)
04-03 14:12:13.712: W/webcore(20618):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:579)
04-03 14:12:13.712: W/webcore(20618):  at dalvik.system.NativeStart.main(Native Method)

 

自己半天没解决到,在网上百度了答案很多

1,就是你访问的URL地址前面要加个HTTP;例如www.baidu.com在代码中就该写成http:www.baidu.com;

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.

2:

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://.

我发现的问题是因为没有http://或https://的url。所以我添加这个标签如果url不包含http://或https://。

3

In my case, I fixed it by changing the order. I put the loadUrl before getSettings()

Working snippet below,

在我的例子中,我通过改变订单固定它。我把getSettings之前loadUrl()

4

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.

答:将抛出这个异常如果你叫requestWindowFeature(Window.FEATURE_NO_TITLE),然后等待太长时间打电话setContentView()。你可以等多久我不明白。所以这两个将成为第一个在onCreate()。时间会告诉我,如果我是正确的。
好消息是,这个警告标签加入webcore只是一个警告和本身造成任何影响的其他应用程序。
坏消息是,似乎我的问题无关,来自其他地方。

这里我就不全部列举了,去网上百度,有很多答案,有全英文的不错,

http://stackoverflow.com/questions/10512282/android-eventhub-removemessagesint-what-107-is-not-supported-before-the-we

http://stackoverflow.com

我的问题是因为我访问的页面时自己写的html页面,放在本地的服务Tomcat下面 的,所以需要先打开Tomcat,然后才能模拟器访问到;

一般的都不会出错,一般解决办法,先把地址在网页上试试能不能打开,然后再在代码中用

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值