Unable to add window -- token null is not for an application
2015-04-29 16:14
411 查看
参考
08-07 21:26:43.506: ERROR/AndroidRuntime(9390): android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application
后google解决,代码中显示语句如下
AlertDialog imageDialog = new AlertDialog.Builder(context).setTitle("状态操作").setItems(items,
listener).create();
imageDialog.show();
其中context为在OnCreate中
context = getApplicationContext();
得到,而AlertDialog创建语句
public AlertDialog.Builder (Context context)
中,不能使用getApplicationContext()得到的context,而必须使用Activity,所有语句修改为
AlertDialog imageDialog = new AlertDialog.Builder(Activity.this).setTitle("状态操作").setItems(items,
listener).create();
imageDialog.show();
其中的Activity为当前Activity的名称
参考:
/article/1853430.html
08-07 21:26:43.506: ERROR/AndroidRuntime(9390): android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application
后google解决,代码中显示语句如下
AlertDialog imageDialog = new AlertDialog.Builder(context).setTitle("状态操作").setItems(items,
listener).create();
imageDialog.show();
其中context为在OnCreate中
context = getApplicationContext();
得到,而AlertDialog创建语句
public AlertDialog.Builder (Context context)
中,不能使用getApplicationContext()得到的context,而必须使用Activity,所有语句修改为
AlertDialog imageDialog = new AlertDialog.Builder(Activity.this).setTitle("状态操作").setItems(items,
listener).create();
imageDialog.show();
其中的Activity为当前Activity的名称
参考:
/article/1853430.html
相关文章推荐
- AlertDialog显示错误 Unable to add window token null is not for an application
- Android酱油笔记之关于AlertDialog的Unable to add window token null is not for an application解决办法
- android使用AlertDialog提示 Unable to add window -- token null is not for an application的解决方案
- AlertDialog显示错误 Unable to add window token null is not for an application
- WindowManager$BadTokenException:Unable to add window--token null is not for an application
- 错误:Unable to add window -- token null is not for an application
- Dialog throwing "Unable to add window — token null is not for an application” with getApplication()
- Android开发之关于“Unable to add window - token null is not for an application ”的异常
- AlertDialog显示错误 Unable to add window token null is not for an application
- Unable to add window -- token null is not for an application错误的解决方法
- Unable to add window -- token null is not for an application---各种bug
- AlertDialog:Unable to add window -- token null is not for an application
- Unable to add window -- token null is not for an application
- Unable to add window -- token null is not for an application
- AlertDialog显示错误 Unable to add window token null is not for an application
- android AlertDialog显示错误 Unable to add window token null is not for an application
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application
- Unable to add window -- token null is not for an application
- 在创建一个Dialog时,发生的错误: Unable to add window -- token null is not for an application
- Unable to add window -- token null is not for an application