My Android app is experiencing this crash randomly during operation, and I think it is due to a pending MotionEvent that is dispatched to a null object, but not sure.
here is the crash output:
java.lang.NullPointerException
at android.webkit.BrowserFrame.getRequestInterceptor(BrowserFrame.java:1108)
at android.webkit.FrameLoader.handleRequestIntercept(FrameLoader.java:426)
at android.webkit.FrameLoader.handleHTTPLoad(FrameLoader.java:226)
at android.webkit.WebViewWorker.handleMessage(WebViewWorker.java:124)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:143)
at android.os.HandlerThread.run(HandlerThread.java:60)
My Android app manually creates a custom WebView and adds it to the ViewGroup in the Activity.onCreate() method like this:
ViewGroup groupA = (ViewGroup)findViewById(R.id.frame_layout_rowA);
webViewRowA = new MyWebView(this);
groupA.addView(webViewRowA);
The reason for doing it this way was to be able to get to the constructor for the WebView in order to pass getApplicationContext() instead of this to the constructor, which was a workaround for a memory leak in 2.1.
The issue, I think, is that this Activity is restarted frequently. This causes the normal chain of onStop(), onDestroy(), onCreate(), etc... to happen often.
So my question is, could the crashes be due to a MotionEvent being dispatched to an instance of MyWebView that was attached to an old Activity that has been garbage collected? Such as if the user clicked something in a webview right before this actvity was recycled?
Another thing to note is I'm seeing these messages following a call to onDestroy()
/webviewglue( 436): nativeDestroy view: 0xd738d0
Any help or insight anyone might have, would be greatly appreciated. I've been banging away at this issue for a while now.
Oh, one other thing to note....this started happening in Android OS 2.2. I've submitted a bug to Google, but not sure it is their issue.
Thanks in advance.