timroes / SwipeToDismissUndoList

An Android library to enable swipe to dismiss and undo functionality on ListViews.
250 stars 72 forks source link

android.view.WindowManager$BadTokenException #3

Open timroes opened 11 years ago

timroes commented 11 years ago

Someone reported an error over the Google Play demo app:

android.view.WindowManager$BadTokenException: Unable to add window -- token null is not valid; is your activity running?
at android.view.ViewRootImpl.setView(ViewRootImpl.java:697)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:345)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:224)
at android.view.WindowManagerImpl$CompatModeWrapper.addView(WindowManagerImpl.java:149)
at android.view.Window$LocalWindowManager.addView(Window.java:554)
at android.widget.PopupWindow.invokePopup(PopupWindow.java:1013)
at android.widget.PopupWindow.showAtLocation(PopupWindow.java:856)
at android.widget.PopupWindow.showAtLocation(PopupWindow.java:820)
at de.timroes.swipetodismiss.SwipeDismissList$4.onAnimationEnd(SwipeDismissList.java:512)
at com.nineoldandroids.animation.ValueAnimator.endAnimation(ValueAnimator.java:1034)
at com.nineoldandroids.animation.ValueAnimator.access$900(ValueAnimator.java:43)
at com.nineoldandroids.animation.ValueAnimator$AnimationHandler.handleMessage(ValueAnimator.java:669)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4898)
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:1006)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
at dalvik.system.NativeStart.main(Native Method)

Comment was:

in collapse mode, i swipe some items and hit the home button before the end of the undo bar

Unfortunately I wasn't able to reproduce that. So if anyone else had that behavior I would be very glad, if you let me know and help me reproduce it.

(I have an idea what it is, but to investigate it and see if possible solutions work, I would need to reproduce it.)

diamadis commented 11 years ago

I think i was able to reproduce it with my set up. I have a Popupwindow that contains a https://github.com/chrisbanes/Android-PullToRefresh. I used SwipeToDismissUndoList for the list and when the SwipeToDismissUndoList executes the .showAtPosition for the mUndoPopup i get the

android.view.WindowManager$BadTokenException: Unable to add window -- token android.view.ViewRootImpl$W@42238078 is not valid; is your activity running?

timroes commented 11 years ago

Thanks for this information. I guess this will help me reproducing it, and hopefully fixing it.

timroes commented 10 years ago

Moved to: https://github.com/timroes/EnhancedListView/issues/2