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

来源:互联网 发布:java 最大公约数 编辑:程序博客网 时间:2024/05/20 17:28
08-01 06:58:20.188 9791-9791/com.wlkj.ciyun E/AndroidRuntime: FATAL EXCEPTION: main                                                              Process: com.wlkj.ciyun, PID: 9791                                                              android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application                                                                  at android.view.ViewRootImpl.setView(ViewRootImpl.java:543)                                                                  at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:259)                                                                  at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)                                                                  at android.app.Dialog.show(Dialog.java:286)


写Dialog时候 运行报错,这个其实是我们使用上下文错误 ,这里必须使用this或activity.this  而不能使用getBaseContext ();

阅读全文
0 0
原创粉丝点击