У меня есть cra sh на всех моих устройствах, иногда вообще нет. Это подробности исключения
************ CAUSE OF ERROR ************
android.view.WindowManager$BadTokenException: Unable to add window -- window android.view.ViewRootImpl$W@9bd500 has already been added
at android.view.ViewRootImpl.setView(ViewRootImpl.java:1014)
at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:384)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:101)
at android.widget.PopupWindow.invokePopup(PopupWindow.java:1471)
at android.widget.PopupWindow.showAtLocation(PopupWindow.java:1235)
at android.widget.PopupWindow.showAtLocation(PopupWindow.java:1202)
at android.widget.Editor$HandleView.updatePosition(Editor.java:5036)
at android.widget.Editor$PositionListener.onPreDraw(Editor.java:3400)
at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:1045)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2944)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1863)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8072)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:911)
at android.view.Choreographer.doCallbacks(Choreographer.java:723)
at android.view.Choreographer.doFrame(Choreographer.java:658)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:7000)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:441)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408)
************ Timestamp ************1579946245
************ DEVICE INFORMATION ***********
Brand: samsung
Device: gtaxllte
Model: SM-T585
Id: M1AJQ
Product: gtaxlltexx
************ BUILD INFO ************
SDK: 27
Release: 8.1.0
Incremental: T585XXU5CSG3
Я использую следующие пакеты: SweetAlert, zbarscanner Я использую getContext()
для тостов и других и getActivity()
для диалогов SweetAlert
Как я могу решить эту проблему?