日期:2014-05-20  浏览次数:20718 次

android中在activity上启动dialog上启动spinner的一个问题
如果我在第一个activity1设置android:clearTaskOnLaunch="true",用他启动另一个activity2,在activity2启动一个dialog,dialog上有个spinner,点击spinner弹出列表,按end键返回桌面,再次要点击进入这个app时报错,log如下:

04-21 22:17:01.320: INFO/ActivityManager(54): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=zjg.test/.MyTest bnds=[222,173][308,246] }
04-21 22:17:01.489: ERROR/WindowManager(765): Activity zjg.test.Test2 has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@43be9c60 that was originally added here
04-21 22:17:01.489: ERROR/WindowManager(765): android.view.WindowLeaked: Activity zjg.test.Test2 has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@43be9c60 that was originally added here
04-21 22:17:01.489: ERROR/WindowManager(765):     at android.view.ViewRoot.<init>(ViewRoot.java:227)
04-21 22:17:01.489: ERROR/WindowManager(765):     at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:148)
04-21 22:17:01.489: ERROR/WindowManager(765):     at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
04-21 22:17:01.489: ERROR/WindowManager(765):     at android.view.Window$LocalWindowManager.addView(Window.java:424)
04-21 22:17:01.489: ERROR/WindowManager(765):     at android.app.Dialog.show(Dialog.java:239)
04-21 22:17:01.489: ERROR/WindowManager(765):     at android.app.AlertDialog$Builder.show(AlertDialog.java:802)
04-21 22:17:01.489: ERROR/WindowManager(765):     at android.widget.Spinner.performClick(Spinner.java:257)
04-21 22:17:01.489: ERROR/WindowManager(765):     at android.view.View.onTouchEvent(View.java:4179)
04-21 22:17:01.489: ERROR/WindowManager(765):     at android.view.View.dispatchTouchEvent(View.java:3709)
04-21 22:17:01.489: ERROR/WindowManager(765):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:852)
04-21 22:17:01.489: ERROR/WindowManager(765):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
04-21 22:17:01.489: ERROR/WindowManager(765):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
04-21 22:17:01.489: ERROR/WindowManager(765):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
04-21 22:17:01.489: ERROR/WindowManager(765):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
04-21 22:17:01.489: ERROR/WindowManager(765):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
04-21 22:17:01.489: ERROR/WindowManager(765):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
04-21 22:17:01.489: ERROR/WindowManager(765):     at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1659)
04-21 22:17:01.489: ERROR/WindowManager(765):     at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1107)
04-21 22:17:01.489: ERROR/WindowManager(765):     at android.app.Dialog.dispatchTouchEvent(Dialog.java:643)
04-21 22:17:01.489: ERROR/WindowManager(765):     at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1643)