首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java面试 >

android中在activity下启动dialog下启动spinner的一个有关问题

2012-12-17 
android中在activity上启动dialog上启动spinner的一个问题如果我在第一个activity1设置android:clearTaskO

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)


04-21 22:17:01.489: ERROR/WindowManager(765):     at android.view.ViewRoot.handleMessage(ViewRoot.java:1691)
04-21 22:17:01.489: ERROR/WindowManager(765):     at android.os.Handler.dispatchMessage(Handler.java:99)
04-21 22:17:01.489: ERROR/WindowManager(765):     at android.os.Looper.loop(Looper.java:123)
04-21 22:17:01.489: ERROR/WindowManager(765):     at android.app.ActivityThread.main(ActivityThread.java:4363)
04-21 22:17:01.489: ERROR/WindowManager(765):     at java.lang.reflect.Method.invokeNative(Native Method)
04-21 22:17:01.489: ERROR/WindowManager(765):     at java.lang.reflect.Method.invoke(Method.java:521)
04-21 22:17:01.489: ERROR/WindowManager(765):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
04-21 22:17:01.489: ERROR/WindowManager(765):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
04-21 22:17:01.489: ERROR/WindowManager(765):     at dalvik.system.NativeStart.main(Native Method)

我想问一下这时候不应该是dialog自动销毁么,为什么会出现这种错误,为什么activity2不能自动销毁。
[解决办法]
请问楼主,此问题有解决方案了吗,本人也遇到了,还请楼主不吝赐教啊

热点排行