码迷,mamicode.com
首页 > 移动开发 > 详细

Android日常知识收集与总结之

时间:2015-03-10 19:37:09      阅读:151      评论:0      收藏:0      [点我收藏+]

标签:tabhost的alertdialog对话框异常

今天弄项目时发现一个有趣的错误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

Android日常知识收集与总结之

标签:tabhost的alertdialog对话框异常

原文地址:http://9265036.blog.51cto.com/9255036/1619009

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!