Issue
I've been getting this error in my developer portal. I'm not sure why. Stack trace tracks back into some internal function call inside WebView object.
java.lang.NullPointerException
at android.webkit.WebView.loadUrlImpl(WebView.java:3008)
at android.webkit.WebView.loadUrlImpl(WebView.java:3047)
at android.webkit.WebView.loadUrl(WebView.java:3040)
at com.myapp.android.PreviewActivity.notifyJS(PreviewActivity.java:175)
at com.myapp.android.PreviewActivity.access$14(PreviewActivity.java:174)
at com.myapp.android.PreviewActivity$ActionBarItemClickListener.onClick(PreviewActivity.java:901)
at android.view.View.performClick(View.java:3644)
at android.view.View$PerformClick.run(View.java:14313)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4517)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:993)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:760)
at dalvik.system.NativeStart.main(Native Method)
In my code at com.myapp.android.PreviewActivity.notifyJS(PreviewActivity.java:175)
, there is this line
webView.loadUrl("javascript:MyApp.onClick('" + action + "');");
I'm actually invoking a javascript call from my java code. Has anyone faced this issue before?
Solution
I found the answer myself. If webView.destroy()
has already been called then calling webView.loadUrl()
will cause this exception.
Answered By - Sudarshan Bhat
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.