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
android.view.WindowManager$BadTokenException: Unable to add window -- token null is not valid; is your activity running? #92
Comments
Hi, @epool ! override fun onDetachedFromWindow() {
myLifeCycle.handleLifecycleEvent(Lifecycle.Event.ON_DESTROY)
super.onDetachedFromWindow()
} I think your Activity is destroyed but still seems to show and reference the destroyed Activity's context. |
@skydoves yes, it's being used in an Activity. The reason why I'm not using |
Hi, @epool! |
This could happen if you show a tooltip in some event handler where the event is handled just after e.g. user has pressed the back button. I tried safe-guarding by checking For sure, we need some extra checks when showing the balloon. Will try to isolate this in a sample project at some point. Did the OP solve this? |
This issue is also happening for my app. Stacktrace is the same. I use it in an activity. I also use LiveData.
|
@znakeeye @sembozdemir |
@skydoves @sembozdemir |
An alternative approach to skydoves#92 to avoid any reference to the activity isAttachedToWindow will confirm that the anchor view has a valid window token.
Please complete the following information:
Describe the Bug:
We are receiving this crash in our crashlytics console
This is a dummy implementation of our view for a reference implementation:
Expected Behavior:
Don't receive these crashes.
The text was updated successfully, but these errors were encountered: