Android-未知的WebView坠毁原因 [英] Android- unknown webview crash reason

查看:142
本文介绍了Android-未知的WebView坠毁原因的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一类就是它自己的活动,基本上我使用主办网页视图。它适用于大多数设备,但在motorolla仿生机器人在一个加载页面时放屁了这个错误每一次罚款。

I have a class that is its own activity that basically i use to host a webview. It works fine on most devices but on the motorolla droid bionic it farted out this error every once in a while when loading the page.

java.lang.NullPointerException
at android.webkit.WebView.sendOurVisibleRect(WebView.java:2384)
at android.webkit.WebView.onScrollChanged(WebView.java:4820)
at android.view.View.scrollTo(View.java:5016)
at android.webkit.WebView.onOverScrolled(WebView.java:2603) 
at android.view.View.overScrollBy(View.java:8890)
at android.webkit.WebView.computeScroll(WebView.java:3004)
at android.view.ViewGroup.drawChild(ViewGroup.java:1562)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.View.draw(View.java:6883)
at android.widget.FrameLayout.draw(FrameLayout.java:357)
at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:2106)
at android.view.ViewRoot.draw(ViewRoot.java:1562)
at android.view.ViewRoot.performTraversals(ViewRoot.java:1298)
at android.view.ViewRoot.handleMessage(ViewRoot.java:1911)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3821)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
at dalvik.system.NativeStart.main(Native Method)

麻烦与调试我只是不能让我的头左右,其中空指针是来自拍摄后.....任何人对机器人仿生类似的问题?或其它设备对这一问题。

After trouble shooting with the debugger I just cant get my head around where the nullpointer is coming from.....anyone have similar problems on the droid bionic? or other devices for that matter.

推荐答案

这个问题是老了,但正如我刚才遇到同样的除外;我认为这将是有益的分享我的结论。

This question is old, but as I just faced this same exception; I thought it would be helpful to share my conclusion.

我有这个活动,有一个非常简单的布局 - 那里的活动内容视图是一个WebView中的单个实例

I had this Activity, with a very simple Layout - where the activity content view was a single instance of a WebView.

它的成立是这样的:

onStart()
{
    this.setContentView(this.browser);
}

和,我在活动的方法的onStop过这样的:

and, I had this in the onStop method of my Activity:

onStop()
{
    this.browser.destroy()
}

我的应用程序逻辑设计的方式,本次活动有启动和停止许多次......所以......很第一次启动和停止,一切正常......但第二次执行后在onStart我有例外。

My application logic was designed in a way that this activity had to start and stop many times...so...the very first time it started and stopped, everything went fine...but after the 2nd execution of "onStart" I had the exception.

所以,我去掉了调用this.browser.destroy()和一切工作......我想,杀了我的目标,因此我只好空...

So, I removed the call to "this.browser.destroy()" and everything worked...I suppose that killed my object and thus I had a reference to null...

所以,如果你得到这个,你失去对你的布局有些人认为有效的参考...只是检查一下你的code,并设法找到它在哪里,它是被空编

So, if you're getting this, you're losing the valid reference to some view in your layout...just examine your code and try to find where is it that it is being "null-ed".

这篇关于Android-未知的WebView坠毁原因的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆