我真的很想知道为什么我的应用程序正常工作购买LogCat产生的错误如下:
12-04 22:10:56.659: E/WindowManager(837): Activity kids.iq.kidsiqpicturesquestion.animal_q_hard_4 has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@40a3d130 that was originally added here
12-04 22:10:56.659: E/WindowManager(837): android.view.WindowLeaked: Activity kids.iq.kidsiqpicturesquestion.animal_q_hard_4 has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@40a3d130 that was originally added here
12-04 22:10:56.659: E/WindowManager(837): at android.view.ViewRoot.<init>(ViewRoot.java:288)
12-04 22:10:56.659: E/WindowManager(837): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:249)
12-04 22:10:56.659: E/WindowManager(837): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:193)
12-04 22:10:56.659: E/WindowManager(837): at android.view.WindowManagerImpl$CompatModeWrapper.addView(WindowManagerImpl.java:118)
12-04 22:10:56.659: E/WindowManager(837): at android.view.Window$LocalWindowManager.addView(Window.java:532)
12-04 22:10:56.659: E/WindowManager(837): at android.app.Dialog.show(Dialog.java:269)
12-04 22:10:56.659: E/WindowManager(837): at kids.iq.kidsiqpicturesquestion.animal_q_hard_4.onBackPressed(animal_q_hard_4.java:5462)
12-04 22:10:56.659: E/WindowManager(837): at android.app.Activity.onKeyUp(Activity.java:2050)
12-04 22:10:56.659: E/WindowManager(837): at android.view.KeyEvent.dispatch(KeyEvent.java:2485)
12-04 22:10:56.659: E/WindowManager(837): at android.app.Activity.dispatchKeyEvent(Activity.java:2280)
12-04 22:10:56.659: E/WindowManager(837): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1649)
12-04 22:10:56.659: E/WindowManager(837): at android.view.ViewRoot.deliverKeyEventPostIme(ViewRoot.java:2895)
12-04 22:10:56.659: E/WindowManager(837): at android.view.ViewRoot.handleFinishedEvent(ViewRoot.java:2868)
12-04 22:10:56.659: E/WindowManager(837): at android.view.ViewRoot.handleMessage(ViewRoot.java:2048)
12-04 22:10:56.659: E/WindowManager(837): at android.os.Handler.dispatchMessage(Handler.java:99)
12-04 22:10:56.659: E/WindowManager(837): at android.os.Looper.loop(Looper.java:132)
12-04 22:10:56.659: E/WindowManager(837): at android.app.ActivityThread.main(ActivityThread.java:4123)
12-04 22:10:56.659: E/WindowManager(837): at java.lang.reflect.Method.invokeNative(Native Method)
12-04 22:10:56.659: E/WindowManager(837): at java.lang.reflect.Method.invoke(Method.java:491)
12-04 22:10:56.659: E/WindowManager(837): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
12-04 22:10:56.659: E/WindowManager(837): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
12-04 22:10:56.659: E/WindowManager(837): at dalvik.system.NativeStart.main(Native Method)
我非常感谢您的帮助。
答案 0 :(得分:1)
引用this answer:“您在退出活动后尝试显示对话框。”它归结为活动结束后(通过调用finish()
或使用后退按钮(这里是这种情况))的问题,您尝试在活动的顶部显示一个对话框,而不是已经存在了。这是不可能的。
答案 1 :(得分:1)
似乎在Activity正在改变时启动了Dialog。即当要显示Dialog时,不存在正确活动的窗口。对话框与启动它的活动窗口相关联。
答案 2 :(得分:1)
我要看的是:
12-04 22:10:56.659: E/WindowManager(837): at kids.iq.kidsiqpicturesquestion.animal_q_hard_4.onBackPressed(animal_q_hard_4.java:5462)
很可能函数中的某些东西导致错误。尝试评论整个功能,看看你是否还有它。
答案 3 :(得分:1)
这将显示异常..
12-04 22:10:56.659: E/WindowManager(837): Activity kids.iq.kidsiqpicturesquestion.animal_q_hard_4 has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@40a3d130 that was originally added here
12-04 22:10:56.659: E/WindowManager(837): android.view.WindowLeaked: Activity kids.iq.kidsiqpicturesquestion.animal_q_hard_4 has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@40a3d130 that was originally added here
这是因为您在Activity
中显示了一个对话框..但此处Activity
已经完成,因此它会给您例外的信息..