Android日常知识收集与总结之

今天弄项目时发现一个有趣的错误BUG,特来记载一下,初步定义为视图加载的问题,



错误信息先沾上来:

java.lang.RuntimeException: Unable to start activity ComponentInfo


java.lang.RuntimeException: Unable to start activity ComponentInfo


java.lang.RuntimeException: Unable to start activity ComponentInfo


android.view.WindowManager$BadTokenException: Unable to add window -- token android.app.LocalActivityManager$LocalActivityRecord@422dc6e8 is not valid; is your activity running?

at android.widget.TabHost$IntentContentStrategy.getContentView(TabHost.java:768)


Andrdoid用仿iphone的TabBar是用TabHost+ActivityGroup来解决的,里面用View堆栈的形式加载 Activity,在里面的Activity用AlertDialog对话框是,报异常:android.view.WindowManager$BadTokenException: Unable to add window -- token android.app.LocalActivityManager$LocalActivityRecord@422dc6e8 is not valid; is your activity running?

把AlertDialog里面的context:xxxActivity.this 改为::“xxxActivity.this..getParent()”就搞定!


本文出自 “9255036” 博客,请务必保留此出处http://9265036.blog.51cto.com/9255036/1619009

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。