android.view.WindowManager$BadTokenException: Unable to add window -- token null is not valid
来源:互联网 发布:成都关键词优化公司 编辑:程序博客网 时间:2024/05/24 20:08
getContext();
出现标题这样的问题,一定是因为上下文引用的不正确. 只能引用Activity这个上下文,不能引用applicationContext
我是在
final View v = View.inflate(LoginActivity.this, R.layout.activity_register, null);这句代码中.我使用了 getApplication() 这句代码去获得它的相关的控件,导致这个控件就依赖了这个上下文了.
我发现这个问题是通过
getContext();
这个方法去获得当前这个控件的上下文对象是什么,然后顺藤摸瓜找到答案的.如果大家遇到相同问题,可以用这个方法去查看你的当前的上下文对象是否正确.
0 0
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not valid; is yo
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not valid; is yo
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not valid; is yo
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not valid
- android.view.WindowManager$BadTokenException:Unable to add window --token is not valid; is your acti
- Android报错android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for
- 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
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an appli
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an appli
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an appli
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an appli
- 关于android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an app
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an appli
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an appli
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an appli
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an appli
- RabbitMQ消息队列(六):使用主题进行消息分发
- Java语言描述:动态规划法之编辑距离问题
- RabbitMQ消息队列(七):适用于云计算集群的远程调用(RPC)
- RabbitMQ消息队列的小伙伴(八): ProtoBuf(Google Protocol Buffer)
- Java 关于容器集合等数据结构详情图解,一目了然
- android.view.WindowManager$BadTokenException: Unable to add window -- token null is not valid
- IRAF处理文件整理器,搞定上线!!!
- RabbitMQ消息队列(九):Publisher的消息确认机制
- linux:用户和组文件解释(/etc/passwd、/etc/shadow、/etc/group、/etc/gshadow)
- cron表达式详解
- spring整合消息队列rabbitmq
- gpio_direction_output 和 gpio_set_value用法的区别
- RxJava的Subscriber出现onError时
- 【架构】关于RabbitMQ