Java nullpointer exception from Webview

I tried to find this problem, but this error does not look the same as this error (my version of the game for Google is newer and note that the error is in a different line of WebViewClassic, so there may be a different error or in a newer version), but i got exactly the same error exception from webview

java.lang.NullPointerException
at android.webkit.WebViewClassic$WebViewInputConnection.setNewText(WebViewClassic.java:583)
at android.webkit.WebViewClassic$WebViewInputConnection.setComposingText(WebViewClassic.java:323)
at android.webkit.WebViewClassic$WebViewInputConnection.commitText(WebViewClassic.java:339)
at com.android.internal.view.IInputConnectionWrapper.executeMessage(IInputConnectionWrapper.java:279)
at com.android.internal.view.IInputConnectionWrapper$MyHandler.handleMessage(IInputConnectionWrapper.java:77)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:153)
at android.app.ActivityThread.main(ActivityThread.java:5297)
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:833)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
at dalvik.system.NativeStart.main(Native Method)

However, I do not use any webview class directly. However, this problem may be related to AdView, but I do not understand how to do it. My code is as follows:

 @Override
 public void onPause() {
    //TODO: these lines are created because onPuase of Adview doesn't work

     if ( adView != null ) {
         adView.pause();
         adView.destroy();
         adView = null;

         Log.i(ApplicationData.APP_TAG, TAG + ": OnPause, pausing the Adview");
     }

     super.onPause();

 }

The error appears after the Log.i line, I expected this error to appear when AdView was called, but not after. Is it possible that this error comes from multithreaded action? Any idea how to avoid the problem?

+1
1

https://developer.android.com/reference/com/google/android/gms/ads/AdView.html AdView.destroy(), adView.pause() onPause() AdView.destroy() onDestroy().

, AdView.

+2

All Articles