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

Stack Overflow | 3lolo | 7 months ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    Android listview with EditText

    Stack Overflow | 7 months ago | 3lolo
    android.view.WindowManager$BadTokenException: Unable to add window -- token null is not valid; is your activity running?
  2. 0

    Display popup on start of activity

    Stack Overflow | 2 years ago | Zac Powell
    java.lang.RuntimeException: Unable to start activity ComponentInfo{jabu.com.languagetemplate/jabu.com.languagetemplate.GameActivity}: android.view.WindowManager$BadTokenException: Unable to add window -- token null is not valid; is your activity running?
  3. 0

    PopupWindow.showAtLocation() causes WindowManager$BadTokenException when using onSaveInstanceState() to handle device rotation

    Stack Overflow | 4 years ago | Vikram
    android.view.WindowManager$BadTokenException: Unable to add window -- token null is not valid; is your activity running?
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    how to show popup window in my main window?

    Stack Overflow | 6 years ago | ganesh
    java.lang.RuntimeException: Unable to start activity ComponentInfo{popupTest.popupTest/popupTest.popupTest.popupTest}: android.view.WindowManager$BadTokenException: Unable to add window -- token null is not valid; is your activity running?
  6. 0

    Android PopupWindow wont open properly

    Stack Overflow | 6 years ago | RenegadeAndy
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.andy.tabletsms.tablet/com.andy.tabletsms.work.SMSPopup}: android.view.WindowManager$BadTokenException: Unable to add window -- token null is not valid; is your activity running?
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. android.view.WindowManager$BadTokenException

    Unable to add window -- token null is not valid; is your activity running?

    at android.view.ViewRootImpl.setView()
  2. Android Platform
    PopupWindow.showAtLocation
    1. android.view.ViewRootImpl.setView(ViewRootImpl.java:696)
    2. android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:289)
    3. android.view.WindowManagerImpl.addView(WindowManagerImpl.java:85)
    4. android.widget.PopupWindow.invokePopup(PopupWindow.java:1153)
    5. android.widget.PopupWindow.showAtLocation(PopupWindow.java:978)
    6. android.widget.PopupWindow.showAtLocation(PopupWindow.java:942)
    6 frames
  3. com.meizu.widget
    MagnifierPopupWindow.showMagnifier
    1. com.meizu.widget.MagnifierPopupWindow.showMagnifier(MagnifierPopupWindow.java:106)
    1 frame
  4. Android Platform
    ActivityThread.main
    1. android.widget.Editor$MzInsertionPointCursorController.update(Editor.java:5567)
    2. android.widget.Editor$MzInsertionPointCursorController.show(Editor.java:5571)
    3. android.widget.Editor.performLongClickMz(Editor.java:5290)
    4. android.widget.TextView.performLongClick(TextView.java:9126)
    5. android.view.View$CheckForLongPress.run(View.java:20357)
    6. android.os.Handler.handleCallback(Handler.java:815)
    7. android.os.Handler.dispatchMessage(Handler.java:104)
    8. android.os.Looper.loop(Looper.java:194)
    9. android.app.ActivityThread.main(ActivityThread.java:5824)
    9 frames
  5. Java RT
    Method.invoke
    1. java.lang.reflect.Method.invoke(Native Method)
    2. java.lang.reflect.Method.invoke(Method.java:372)
    2 frames
  6. Android
    ZygoteInit.main
    1. com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1010)
    2. com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
    2 frames