Android: Activity has leaked window @ 4/26/2018

学习类
from: stackoverflow

Android报错如下:
ERROR/WindowManager(18850): Activity com.ifyr.demo has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@44c46ff0 that was originally added here
ERROR/WindowManager(18850): android.view.WindowLeaked: Activity com.ifyr.demo has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@44c46ff0 that was originally added here

可能原因1:
You're trying to show a Dialog after you've exited an Activity.

可能原因2:
This error can be a little misleading in some circumstances (although the answer is still completely accurate) - i.e. in my case an unhandled Exception was thrown in an AsyncTask, which caused the Activity to shutdown, then an open progressdialog caused this Exception.. so the 'real' exception was a little earlier in the log

可能原因3:
Call dismiss() on the Dialog instance you created before exiting your Activity, e.g. in onPause() or onDestroy()
发布于 4/26/2018 17:53:40 | 评论:0

看帖要回帖...

categories
archives
links
statistics
  • 网志数:1135
  • 评论数:2011