Android怎么解决AlertDialog对话框异常
Android怎么解决AlertDialog对话框异常?这个问题可能是我们日常工作经遇见到的。通过这个问题,希望你能收获更多。如果你不看答案,不知道是否有把握回答这个问题?让我们来试试。
错误信息先沾上来:
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()”就搞定!
看完上述内容,你们对Android解决AlertDialog对话框异常的方法有进一步的了解吗?如果还想学到更多技能或想了解更多相关内容,欢迎关注亿速云行业资讯频道,感谢各位的阅读!
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。