douglasjunior / android-simple-tooltip

A simple library based on PopupWindow to create Tooltips on Android. 💚

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Throwing NullPointer Exception when we call dismiss() explicitly

jettimadhu opened this issue · comments

Hi,
I have tried to call dismiss() in below cases

  1. When the Orientation changes
  2. When the user presses the device back key
    It throws below error

When I change the orientatton:

java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.dispatchConfigurationChanged(android.content.res.Configuration)' on a null object reference
at android.view.ViewGroup.dispatchConfigurationChanged(ViewGroup.java:1520)
at android.view.ViewRootImpl.updateConfiguration(ViewRootImpl.java:3743)
at android.view.ViewRootImpl.performConfigurationChange(ViewRootImpl.java:3705)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2016)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1465)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7233)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:979)
at android.view.Choreographer.doCallbacks(Choreographer.java:791)
at android.view.Choreographer.doFrame(Choreographer.java:726)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:965)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6651)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:810)

And
when i press device back key:

java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.dispatchVisibilityChanged(android.view.View, int)' on a null object reference
at android.view.ViewGroup.dispatchVisibilityChanged(ViewGroup.java:1484)
at android.view.View.setFlags(View.java:13470)
at android.view.View.setVisibility(View.java:9458)
at android.app.Dialog.hide(Dialog.java:413)
at android.inputmethodservice.InputMethodService.hideWindow(InputMethodService.java:1737)
at com.kpt.xploree.app.KPTAdaptxtIME.hideWindow(KPTAdaptxtIME.java:2153)
at android.inputmethodservice.InputMethodService.doHideWindow(InputMethodService.java:1731)
at android.inputmethodservice.InputMethodService.-wrap2(Unknown Source:0)
at android.inputmethodservice.InputMethodService$InputMethodImpl.hideSoftInput(InputMethodService.java:461)
at android.inputmethodservice.IInputMethodWrapper.executeMessage(IInputMethodWrapper.java:199)
at com.android.internal.os.HandlerCaller$MyHandler.handleMessage(HandlerCaller.java:37)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6651)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:810)

Same issue here!

When the Orientation changes your activity is re-created, so you loose the reference to the te current Tooltip.

Can you create a small project to demonstrate this problem?