I know this question is discussed several time but believe me i never got any answer working.
In my Main Activity i have used few Dialog to inform user about some operations but i get this specific error mostly (specifically 96%) on Xiaomi devices.
`
Fatal Exception: android.view.WindowManager$BadTokenException
Unable to add window -- token android.os.BinderProxy@f839de9 is not valid; is your activity running?
android.view.ViewRootImpl.setView (ViewRootImpl.java:697)
android.view.WindowManagerGlobal.addView (WindowManagerGlobal.java:347)
android.view.WindowManagerImpl.addView (WindowManagerImpl.java:94)
android.widget.Toast$TN.handleShow (Toast.java:463)
android.widget.Toast$TN$2.handleMessage (Toast.java:346)
android.os.Handler.dispatchMessage (Handler.java:102)
android.os.Looper.loop (Looper.java:163)
android.app.ActivityThread.main (ActivityThread.java:6377)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:904)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:794)
I covered each Dialog Show method like
if (!MainActivityNew.this.isFinishing())
dialogDownload.show();
`
But still i am getting this error in release mode mostly on Xiaomi Devices
With Android Version 7, Please help me i stuck on this problem from past one month.
Here is some data from firebase Crashlytics
Devices
100% Xiaomi
Operating systems
100% Android 7
Device states
4% background
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…