Caused by: android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application
在广播中启动一个Dialog时出现如下错误信息:Caused by: android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application
在代码中添加了dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);错误信息没有消除,
此时在Manifest.xml文件中添加系统权限,并添加:
允许应用使用TYPE_SYSTEM_ALERT来打开窗口,并将窗口显示于其他应用的顶端
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
的权限,对话框可以起来了。
Caused by: 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
原博客地址:http://aijiawang-126-com.javaeye.com/blog/662336 在Activity中newSpinner是我把mContext传入,但是出了 andr ...
- android.view.WindowManager$BadTokenException: Unable to add window — token null is not for an applic
之前遇到过这样的问题, 04-12 10:40:33.302: E/AndroidRuntime(17213): Caused by: android.view.WindowManager$BadTo ...
- Activity has leaked window that was originally added -界面退出时未关闭对话框异常 android.view.WindowManager$BadTokenException: Unable to add window -- token null is not valid; is your activity running? -
退出Activity时弹出登录框,点击确定finish当前Activity,结果报了这个错,随后查找资料知道 原因: 是因为退出Activity时没有关闭弹出框,出现了这个错误 解决方法: 只需要在a ...
- Android自用-----WindowManager$BadTokenException: Unable to add window -- token null is not for an application
转自http://www.cnblogs.com/oakpip/archive/2011/04/06/2007310.html 错误产生: private Context mcontext; @Ove ...
- bug_ _ android.view.WindowManager$BadTokenException: Unable to add window -- token
========4 关于android的一个常见错误:Unable to add window --token is not valid android.view.WindowManage ...
- Unable to add window -- token null is not for an application错误的解决方法 android开发
Caused by: android.view.WindowManager$BadTokenException: Unable to add window -- token null is not f ...
- 关于ProgressDialog.show抛出android.view.WindowManager$BadTokenException: Unable to add window
下午摆弄ProgressDialog,进入就抛错:android.view.WindowManager$BadTokenException: Unable to add window -- token ...
- android.view.WindowManager$BadTokenException: Unable to add window
这是在加载dialog时出现的一个异常.转载地址:http://hi.baidu.com/fbdfp/item/7dea2d0ade9121813d42e23d 扔了好久的android又开始断断续续 ...
- Unable to add window -- token null is not for an application
导致报这个错是在于new AlertDialog.Builder(mcontext),虽然这里的参数是AlertDialog.Builder(Context context)但我们不能使用getApp ...
随机推荐
- AJAX技术初级探索
一 概念 Ajax技术能够实现页面以异步方式从服务器获取信息,无需刷新页面 Ajax的核心技术是XMLHttpRequest对象(XHR) 异步实际就是请求数据的代码不会阻塞页面向下执行 二 原生Aj ...
- 全局下的isFinite
isFinite() 函数用于检查其参数是否是无穷大 1. 他是一个全局对象,可以在js代码中直接使用 2. isFinite() 函数用于检查其参数是否是无穷大. 3. 如果 number 是有限 ...
- [Python] Tkinter的食用方法_01_简单界面
#开始 放假之后感觉整个人已经放飞自我了,完全不知道自己一天天在干什么,明明有很多的事情需要做,但是实际上每天啥都没做,,,虚度光阴... 晚上突然心烦意乱,开始思考今天一天都做了什么,感觉很有负罪感 ...
- POJ 1061 青蛙的约会(exgcd)
嗯... 题目链接:http://poj.org/problem?id=1061 两只青蛙相遇时肯定满足:x+k*m≡y+k*n(mod L) x+k*m-(y+k*n)=L*s k*(n-m)-s* ...
- AOP的基本认识
一.AOP的概念 AOP(Aspect Oriented Programming),即面向切面编程,可以说是OOP(Object Oriented Programming,面向对象编程)的补充和完善. ...
- zabbix邮件脚本报警
#启动邮箱服务 systemctl start postfix.service #配置用户的邮箱发送邮件 vim /etc/mail.rc set from="xxx@xxx.com&quo ...
- PTA的Python练习题(十三)
第4章-8 求分数序列前N项和 a=eval(input()) b=2 c=1 d=0 count=0 for i in range(a): count+=b/c d=b b=b+c c=d prin ...
- linux与python3安装redis
1.linux安装redis服务 apt-get install redis* 进入客户端管理 redis-cli 启动服务 service redis startservice redis rest ...
- 吴裕雄 python 神经网络——TensorFlow 变量管理
import tensorflow as tf with tf.variable_scope("foo"): v = tf.get_variable("v", ...
- MySQL优化2.索引
什么是索引: 索引的作用相当于图书的目录,可以根据目录中的页码快速找到所需的内容. 建立索引合适的列 经常用作where条件的列,order by排序的列 数据列不重复而且并不是唯一的几个值 不被经常 ...