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

关于Android PopupWindow中实用Spinner控件点击APP Crash情况整理!

时间:2014-07-16 14:17:10      阅读:306      评论:0      收藏:0      [点我收藏+]

标签:android   style   java   strong   os   art   

场景异常信息如下:

android.view.WindowManager$BadTokenException: Unable to add window -- token android.view.ViewRootImpl$W@4190fd98 is not valid; is your activity running?

at android.view.ViewRootImpl.setView(ViewRootImpl.java:646)
at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:248)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)
at android.widget.PopupWindow.invokePopup(PopupWindow.java:993)
at android.widget.PopupWindow.showAsDropDown(PopupWindow.java:899)
at android.widget.ListPopupWindow.show(ListPopupWindow.java:603)
at android.widget.Spinner$DropdownPopup.show(Spinner.java:981)
at android.widget.Spinner.performClick(Spinner.java:609)
at android.view.View$PerformClick.run(View.java:17476)
at android.os.Handler.handleCallback(Handler.java:800)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5392)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)

at dalvik.system.NativeStart.main(Native Method)

解决办法:

方案一:

给Spinner控件加上android:spinnerMode="dialog"属性可以解决点击崩溃的问题,但是样式非常原始;

方案二:

未完待续....


关于Android PopupWindow中实用Spinner控件点击APP Crash情况整理!,布布扣,bubuko.com

关于Android PopupWindow中实用Spinner控件点击APP Crash情况整理!

标签:android   style   java   strong   os   art   

原文地址:http://blog.csdn.net/anqixing/article/details/37875541

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