android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application

cnblogs.com | 2 months ago
tip
Do you find the tips below useful? Click on the to mark them and say thanks to rafael . Or join the community to write better ones.
  1. 0

    Android对话框之Context - bvin - 博客园

    cnblogs.com | 2 months ago
    android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application
  2. 0

    error while adding alertdialog box in fragment

    Stack Overflow | 3 years ago | Nawaf
    android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application
  3. 0
    samebug tip
    This issue was solved in 2.2.6. If updating doesn't solve, try using notifyItemRangeChanged(1, mDatas.size()) instead of notifyItemRangeChanged(0, mDatas.size()).
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Cannot open spinner with alert dialog in android

    Stack Overflow | 1 year ago | Wai Yan Hein
    android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application
  6. 0

    Applicaton has stopped error after create instance of AlertDialog

    Stack Overflow | 1 year ago | The.Only.One
    android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application
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 for an application

    at android.view.ViewRootImpl.setView()
  2. Android Platform
    AlertDialog$Builder.show
    1. android.view.ViewRootImpl.setView(ViewRootImpl.java:576)
    2. android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:269)
    3. android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)
    4. android.app.Dialog.show(Dialog.java:289)
    5. android.app.AlertDialog$Builder.show(AlertDialog.java:951)
    5 frames
  3. cn.bvin.app
    MainActivity$1.onClick
    1. cn.bvin.app.androidtest_asgit.MainActivity$1.onClick(MainActivity.java:24)
    1 frame
  4. Android Platform
    ActivityThread.main
    1. android.view.View.performClick(View.java:4446)
    2. android.view.View$PerformClick.run(View.java:18480)
    3. android.os.Handler.handleCallback(Handler.java:733)
    4. android.os.Handler.dispatchMessage(Handler.java:95)
    5. android.os.Looper.loop(Looper.java:136)
    6. android.app.ActivityThread.main(ActivityThread.java:5294)
    6 frames
  5. Java RT
    Method.invoke
    1. java.lang.reflect.Method.invokeNative(Native Method)
    2. java.lang.reflect.Method.invoke(Method.java:515)
    2 frames
  6. Android
    ZygoteInit.main
    1. com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:864)
    2. com.android.internal.os.ZygoteInit.main(ZygoteInit.java:680)
    2 frames
  7. Android Platform
    NativeStart.main
    1. dalvik.system.NativeStart.main(Native Method)
    1 frame