-
Notifications
You must be signed in to change notification settings - Fork 56
Description
I've gotten a bunch of crash reports for this error since I released a new version of an app last week which included Tooltip for the first time.
Exception android.view.WindowManager$BadTokenException: Unable to add window -- token null is not valid; is your activity running? android.view.ViewRootImpl.setView (ViewRootImpl.java:850) android.view.WindowManagerGlobal.addView (WindowManagerGlobal.java:337) android.view.WindowManagerImpl.addView (WindowManagerImpl.java:91) android.widget.PopupWindow.invokePopup (PopupWindow.java:1329) android.widget.PopupWindow.showAsDropDown (PopupWindow.java:1155) android.widget.PopupWindow.showAsDropDown (PopupWindow.java:1114) android.widget.PopupWindow.showAsDropDown (PopupWindow.java:1093) com.tooltip.Tooltip$2.run (Tooltip.java:211) android.os.Handler.handleCallback (Handler.java:739) android.os.Handler.dispatchMessage (Handler.java:95) android.os.Looper.loop (Looper.java:158) android.app.ActivityThread.main (ActivityThread.java:7224) java.lang.reflect.Method.invoke (Method.java) com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1230) com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1120)
After some quick googling I found another tooltip library that had a very similar error in June 2016. It was fixed by checking the root view, douglasjunior/android-simple-tooltip@b8bc55f
As I'm getting the crashes on line 211 in your Tooltip lib I would assume a similar check there would solve this, or what do you say? https://github.com/ViHtarb/Tooltip/blame/master/library/src/main/java/com/tooltip/Tooltip.java#L211
Thanks for a great lib otherwise!