gdx-dialogs icon indicating copy to clipboard operation
gdx-dialogs copied to clipboard

Exception android.view.WindowManager$BadTokenException: Unable to add window -- token

Open mustii82 opened this issue 7 years ago • 9 comments

Some of my Users get this Exceptions randomly:

Exception android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy@1b77d4b9 is not valid; is your activity running? android.view.ViewRootImpl.setView (ViewRootImpl.java:574) android.view.WindowManagerGlobal.addView (WindowManagerGlobal.java:282) android.view.WindowManagerImpl.addView (WindowManagerImpl.java:85) android.app.Dialog.show (Dialog.java:298) de.tomgrill.gdxdialogs.android.dialogs.AndroidGDXButtonDialog$1.run (AndroidGDXButtonDialog.java:70) android.os.Handler.handleCallback (Handler.java:739) android.os.Handler.dispatchMessage (Handler.java:95) android.os.Looper.loop (Looper.java:135) android.app.ActivityThread.main (ActivityThread.java:5910) java.lang.reflect.Method.invoke (Method.java) java.lang.reflect.Method.invoke (Method.java:372) com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1405)

mustii82 avatar Mar 16 '17 23:03 mustii82

May or may not be related to: http://dimitar.me/android-displaying-dialogs-from-background-threads/

Can you give some information how I could reproduce this. Do you use Threads on your project?

TomGrill avatar Mar 17 '17 07:03 TomGrill

Thats the problem :/

I can't because it happened on a user of my app. I have 5.000+ Users but it only appeared 4 times so I think its difficult to reproduce.

I just want to say that there is a possibility that something doesn't work correctly and can trigger other problems

mustii82 avatar Mar 17 '17 14:03 mustii82

In this case I will leave it open for now. When I am in the mute I will try to reproduce with the link above. Maybe I can figure something out.

TomGrill avatar Mar 17 '17 18:03 TomGrill

I have a question how would you call a Dialog in a LibGDX AsyncTask?

mustii82 avatar Apr 08 '17 17:04 mustii82

Looking through the code, I'm sure this API allows calling from any thread. The setup of the dialog is in the end, queued to run on the UI Thread.

Ry-DS avatar May 31 '17 12:05 Ry-DS

The Problem still exists

mustii82 avatar Nov 15 '17 00:11 mustii82

Will probably exist for a very long time, till I stumble accidentally over the same problem. Or I can analyse a working example which reproduces this issue.

TomGrill avatar Nov 15 '17 10:11 TomGrill

the problem still exists. please refer this for solution. ToastCompat

dotw avatar Mar 05 '18 04:03 dotw

thanks, will look into it. may take a while.

TomGrill avatar Mar 05 '18 13:03 TomGrill