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 ...
随机推荐
- Servlt入门
Servlt入门 java的两种体系结构 C/S (客户端/服务器)体系结构 通讯效率高且安全,但系统占用多 B/S (浏览器/服务器)体系结构 节约开发成本 C/S (客户端/服务器)体系结 ...
- Sunday算法浅谈
一.Sunday算法简介 Sunday算法在我看来比起Kmp和bm都更加容易理解,代码实现也更加简洁.Sunday算法由Daniel M.Sunday在1990年提出,它的思想跟BM算法很相似只不过S ...
- js 一句代码 让网页变为编辑器
document.body.contentEditable = true 只要在控制台执行这行语句 页面就可以自由输入编辑了
- cmake使用的一些补充
一般使用cmake生成vs项目的时候,要么生成32位的要么生成64位的. 怎样将32位和64位在一个工程中打开呢,联系我们自己建立的工程都是32位和64位在一起的,就动手开始了. 实验对象是openc ...
- 【C语言】将输入的10个整数逆序输出
代码1: #include <stdio.h> int main() { ], b[]; int i,j; printf("请输入10个整数:\n"); ; i < ...
- Linux下RabbitMQ的安装及使用
过多的描述就不扯了,本文主要记录RabbitMQ的安装以及简单使用.本次安装是为了实现spring cloud的消息总线:SpringCloud全家桶学习之消息总线---SpringCloud Bus ...
- Vue-项目搭建时的常用配置
1.Vue静态资源存放的选择 assets: 编译过程中会被webpack处理理解为模块依赖,只支持相对路径的形式,assets放可能会变动的文件.static: 存放第三方文件的地方,不会被webp ...
- arc066E - Addition and Subtraction Hard
题目链接 题目大意 给定一个只含加减和数字的表达式,在其中添加括号,使其值最大. 解题思路 显然,只有减号后面的括号会使其中表达式的值取反. 然后只有已经有左括号时才能加入右括号. 所以用\(f_0\ ...
- Vulnhub_DC7 记录
基本步骤 经验 & 总结 对信息还是不敏感,其实也是因为对Drupal这个CMS并不熟悉,不知道哪些地方是默认的那些地方是作者修改,比如这个"DC7USER". 对Drup ...
- Wireshark 查看指定进程的网络包
Wireshark 查看指定进程的网络包 打开任务管理器,右键筛选列,选中PID(进程标识符): 找到该进程对应的PID,如1200: 在cmd中执行netstat -ano|findstr 1200 ...