Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception android.view.WindowManager$BadTokenException: Unable to add window -- token null is not valid; is your activity running? #26

Closed
ripern opened this issue Apr 12, 2017 · 5 comments
Labels

Comments

@ripern
Copy link

ripern commented Apr 12, 2017

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!

@ViHtarb ViHtarb added the bug label Apr 13, 2017
ViHtarb added a commit that referenced this issue Apr 13, 2017
@ViHtarb
Copy link
Owner

ViHtarb commented Apr 13, 2017

@ripern Hi, i published this fix in 0.1.9.3-SNAPSHOT

@ViHtarb ViHtarb closed this as completed Apr 13, 2017
@Gaetano-Dati
Copy link

I installed 0.1.9 repo version (latest version) but found this same problem

@ViHtarb
Copy link
Owner

ViHtarb commented Jan 28, 2018

@Gaetano-Dati try to use latest snapshot version

@Gaetano-Dati
Copy link

Do you know why does this error occur?

@ViHtarb
Copy link
Owner

ViHtarb commented Jan 28, 2018

@Gaetano-Dati yes and it`s error fixed in snapshot version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants