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.
I had this Activity, with a very simple Layout – where the activity content view was a single instance of a WebView.
It was set like this:
and, I had this in the onStop method of my Activity:
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.
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…
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”.