Unable to add window token null is not for an application
来源:互联网 发布:mac 邮件储存位置 编辑:程序博客网 时间:2024/06/08 04:57
Java原代码:
AlertDialog.Builder builder;
//self其实是Activity对象的引用,根据你所处的上下文来传入相应的引用就可以了Context self = getApplicationContext();
new AlertDialog.Builder(self).setTitle(R.string.about_title)
.setMessage(R.string.about_msg).setPositiveButton("确认", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
}).show();
这里Context对象不能使用,应改为:
new AlertDialog.Builder(Activity.this).setTitle(R.string.about_title)
.setMessage(R.string.about_msg).setPositiveButton("确认", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
}
}).show();
注意:Activity.this中的Activity是你当前的Activity名称
0 0
- android.view.WindowManager$BadTokenException: 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
- android.view.WindowManager$BadTokenException: 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错误的解决方法
- Android Custom Dialog错误Unable to add window -- token null is not for an application
- Android Custom Dialog错误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
- Unable to add window -- token null is not for an application
- Android Custom Dialog错误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
- 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
- 整理一下 PCI的Memory Mapped IO vs Port IO
- session和cookie的区别
- 用NGUI 显示游戏物体的名字血条
- [leetcode] Insertion Sort List
- Bash脚本15分钟进阶教程
- Unable to add window token null is not for an application
- 完整的windows下搭建Qt开发环境 QT4.8+qt creator2.8.0, 解决 gbd异常中断 和 静态编译
- js DES加密
- JDBC异常总结
- opencv2在直方图反投影算法中使用颜色信息
- android之WebView
- 【数据结构&&算法系列】归并排序简单介绍及python代码
- Opencv之矩阵的掩码操作
- Ubuntu历险记