0

这里真的需要一些帮助。我已经在几台设备上测试了我的应用程序,明天会有一个演示。

我有一个 HTC 欲望 C,与我一直在测试的相同软件版本完全相同。当我在新设备上安装我的应用程序时,它在尝试加载以下行的加载对话框时崩溃:

dialog = ProgressDialog.show(LocationSearchForPeople.this,
                    "Loading Results", "Please wait...", true); 

下面是我的 logcat 的输出。我完全被难住了,它是如何在两个相同的设备之间无法工作的。我希望这可能是设备的问题?

02-06 19:23:05.353: E/WindowManager(3178): Activity com.capgemini.findme.LocationSearchForPeople has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@41014cb0 that was originally added here
02-06 19:23:05.353: E/WindowManager(3178): android.view.WindowLeaked: Activity com.capgemini.findme.LocationSearchForPeople has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@41014cb0 that was originally added here
02-06 19:23:05.353: E/WindowManager(3178):  at android.view.ViewRootImpl.<init>(ViewRootImpl.java:396)
02-06 19:23:05.353: E/WindowManager(3178):  at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:372)
02-06 19:23:05.353: E/WindowManager(3178):  at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:320)
02-06 19:23:05.353: E/WindowManager(3178):  at android.view.WindowManagerImpl$CompatModeWrapper.addView(WindowManagerImpl.java:152)
02-06 19:23:05.353: E/WindowManager(3178):  at android.view.Window$LocalWindowManager.addView(Window.java:557)
02-06 19:23:05.353: E/WindowManager(3178):  at android.app.Dialog.show(Dialog.java:301)
02-06 19:23:05.353: E/WindowManager(3178):  at android.app.ProgressDialog.show(ProgressDialog.java:116)
02-06 19:23:05.353: E/WindowManager(3178):  at android.app.ProgressDialog.show(ProgressDialog.java:99)
02-06 19:23:05.353: E/WindowManager(3178):  at com.capgemini.findme.LocationSearchForPeople$1.onClick(LocationSearchForPeople.java:81)
02-06 19:23:05.353: E/WindowManager(3178):  at android.view.View.performClick(View.java:3538)
02-06 19:23:05.353: E/WindowManager(3178):  at android.view.View$PerformClick.run(View.java:14330)
02-06 19:23:05.353: E/WindowManager(3178):  at android.os.Handler.handleCallback(Handler.java:608)
02-06 19:23:05.353: E/WindowManager(3178):  at android.os.Handler.dispatchMessage(Handler.java:92)
02-06 19:23:05.353: E/WindowManager(3178):  at android.os.Looper.loop(Looper.java:156)
02-06 19:23:05.353: E/WindowManager(3178):  at android.app.ActivityThread.main(ActivityThread.java:4987)
02-06 19:23:05.353: E/WindowManager(3178):  at java.lang.reflect.Method.invokeNative(Native Method)
02-06 19:23:05.353: E/WindowManager(3178):  at java.lang.reflect.Method.invoke(Method.java:511)
02-06 19:23:05.353: E/WindowManager(3178):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
02-06 19:23:05.353: E/WindowManager(3178):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
02-06 19:23:05.353: E/WindowManager(3178):  at dalvik.system.NativeStart.main(Native Method)
02-06 19:23:11.259: D/dalvikvm(3178): GC_CONCURRENT freed 777K, 15% free 5238K/6115K, paused 3ms+6ms
02-06 19:23:14.402: D/AndroidRuntime(3178): Shutting down VM
02-06 19:23:14.402: W/dalvikvm(3178): threadid=1: thread exiting with uncaught exception (group=0x40aa8228)
02-06 19:23:14.402: E/AndroidRuntime_2_crash(3178): crash in the same process: main
02-06 19:23:14.402: E/AndroidRuntime_2_crash(3178): java.lang.IllegalArgumentException: View not attached to window manager
02-06 19:23:14.402: E/AndroidRuntime_2_crash(3178):     at android.view.WindowManagerImpl.findViewLocked(WindowManagerImpl.java:752)
02-06 19:23:14.402: E/AndroidRuntime_2_crash(3178):     at android.view.WindowManagerImpl.removeView(WindowManagerImpl.java:472)
02-06 19:23:14.402: E/AndroidRuntime_2_crash(3178):     at android.view.WindowManagerImpl$CompatModeWrapper.removeView(WindowManagerImpl.java:163)
02-06 19:23:14.402: E/AndroidRuntime_2_crash(3178):     at android.app.Dialog.dismissDialog(Dialog.java:348)
02-06 19:23:14.402: E/AndroidRuntime_2_crash(3178):     at android.app.Dialog$1.run(Dialog.java:139)
02-06 19:23:14.402: E/AndroidRuntime_2_crash(3178):     at android.os.Handler.handleCallback(Handler.java:608)
02-06 19:23:14.402: E/AndroidRuntime_2_crash(3178):     at android.os.Handler.dispatchMessage(Handler.java:92)
02-06 19:23:14.402: E/AndroidRuntime_2_crash(3178):     at android.os.Looper.loop(Looper.java:156)
02-06 19:23:14.402: E/AndroidRuntime_2_crash(3178):     at android.app.ActivityThread.main(ActivityThread.java:4987)
02-06 19:23:14.402: E/AndroidRuntime_2_crash(3178):     at java.lang.reflect.Method.invokeNative(Native Method)
02-06 19:23:14.402: E/AndroidRuntime_2_crash(3178):     at java.lang.reflect.Method.invoke(Method.java:511)
02-06 19:23:14.402: E/AndroidRuntime_2_crash(3178):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
02-06 19:23:14.402: E/AndroidRuntime_2_crash(3178):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
02-06 19:23:14.402: E/AndroidRuntime_2_crash(3178):     at dalvik.system.NativeStart.main(Native Method)
4

1 回答 1

2

显然,您的LocationSearchForPeople活动正在关闭,但ProgressDialog仍处于活动状态。这就是Android抱怨窗口泄漏的原因。您需要在离开启动ProgressDialog.

您可以覆盖活动中的onDestroy方法并在那里LocationSearchForPeople调用dialog.dismiss()

于 2013-02-06T19:33:37.903 回答