android.view.WindowLeaked解决办法

08-07 14:51:28.129: E/WindowManager(22277): Activity com.xxx.xxx.xxx.xxx.LoginActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@416a4268 that was originally added here
08-07 14:51:28.129: E/WindowManager(22277): android.view.WindowLeaked: Activity com..xxx.xxx.xxx.xxx.LoginActivity has leaked windowcom.android.internal.policy.impl.PhoneWindow$DecorView@416a4268 that was originally added here
08-07 14:51:28.129: E/WindowManager(22277):  at android.view.ViewRootImpl.(ViewRootImpl.java:344)
08-07 14:51:28.129: E/WindowManager(22277):  at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:267)
08-07 14:51:28.129: E/WindowManager(22277):  at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:215)
08-07 14:51:28.129: E/WindowManager(22277):  at android.view.WindowManagerImpl$CompatModeWrapper.addView(WindowManagerImpl.java:140)
08-07 14:51:28.129: E/WindowManager(22277):  at android.view.Window$LocalWindowManager.addView(Window.java:537)
08-07 14:51:28.129: E/WindowManager(22277):  at android.app.Dialog.show(Dialog.java:278)
08-07 14:51:28.129: E/WindowManager(22277):  at com.xxx.xxx.xxx.xxx.BaseActivity.showMyProgressDialog(BaseActivity.java:1058)
08-07 14:51:28.129: E/WindowManager(22277):  at com.xxx.xxx.xxx.xxx.LoginActivity.setClickable(LoginActivity.java:580)
08-07 14:51:28.129: E/WindowManager(22277):  at com.xxx.xxx.xxx.xxx.LoginActivity.onClick(LoginActivity.java:482)
08-07 14:51:28.129: E/WindowManager(22277):  at android.view.View.performClick(View.java:3519)
08-07 14:51:28.129: E/WindowManager(22277):  at android.view.View$PerformClick.run(View.java:14140)
08-07 14:51:28.129: E/WindowManager(22277):  at android.os.Handler.handleCallback(Handler.java:605)
08-07 14:51:28.129: E/WindowManager(22277):  at android.os.Handler.dispatchMessage(Handler.java:92)
08-07 14:51:28.129: E/WindowManager(22277):  at android.os.Looper.loop(Looper.java:137)
08-07 14:51:28.129: E/WindowManager(22277):  at android.app.ActivityThread.main(ActivityThread.java:4424)
08-07 14:51:28.129: E/WindowManager(22277):  at java.lang.reflect.Method.invokeNative(Native Method)
08-07 14:51:28.129: E/WindowManager(22277):  at java.lang.reflect.Method.invoke(Method.java:511)
08-07 14:51:28.129: E/WindowManager(22277):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787)
08-07 14:51:28.129: E/WindowManager(22277):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:554)
08-07 14:51:28.129: E/WindowManager(22277):  at dalvik.system.NativeStart.main(Native Method)

 

这个问题属于当前Activity已经onDestroy但是依靠其的Dialog没有dismiss

if (progressDialog != null && progressDialog.isShowing())
{
     progressDialog.dismiss();
}

注意使用this.isFinishing()可能导致progressDialog取消不掉

你可能感兴趣的:(安卓技术)