码迷,mamicode.com
首页 > 其他好文 > 详细

自定义时间选择器调用时报错

时间:2017-03-17 20:43:43      阅读:262      评论:0      收藏:0      [点我收藏+]

标签:lan   cal   main   otto   adt   global   tin   info   app   

FATAL EXCEPTION: main
Process: droid.gdhktech.com.pubhealthdoc, PID: 8948
java.lang.RuntimeException: Unable to start activity ComponentInfo{droid.gdhktech.com.pubhealthdoc/droid.gdhktech.com.pubhealthdoc.ui.acti.MainActivity}: android.view.WindowManager$BadTokenException: Unable to add window -- token null is not valid; is your activity running?
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
Caused by: android.view.WindowManager$BadTokenException: Unable to add window -- token null is not valid; is your activity running?
at android.view.ViewRootImpl.setView(ViewRootImpl.java:562)
at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:282)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:85)
at android.widget.PopupWindow.invokePopup(PopupWindow.java:1104)
at android.widget.PopupWindow.showAtLocation(PopupWindow.java:933)
at android.widget.PopupWindow.showAtLocation(PopupWindow.java:897)
at droid.gdhktech.com.pubhealthdoc.ui.widge.BottomPopupWindow.show(BottomPopupWindow.java:85)
at droid.gdhktech.com.pubhealthdoc.ui.acti.MainActivity.initData(MainActivity.java:42)
at cn.droidlover.xdroid.base.XActivity.onCreate(XActivity.java:31)
at android.app.Activity.performCreate(Activity.java:5990)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387) 
at android.app.ActivityThread.access$800(ActivityThread.java:151) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:135) 
at android.app.ActivityThread.main(ActivityThread.java:5254) 
at java.lang.reflect.Method.invoke(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:372) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) 

 

 

解决:不要直接在activity里面调用,要在OnClickListeners里面调用。

自定义时间选择器调用时报错

标签:lan   cal   main   otto   adt   global   tin   info   app   

原文地址:http://www.cnblogs.com/shenyeli/p/6568207.html

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