窗口管理:MainActivity渗漏窗口com.android.internal.policy.impl.PhoneWindow$DecorView@40731aa0这是原来的 [英] WindowManager: MainActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@40731aa0 that was original
问题描述
这是什么意思是这样的警告?我开发一个Android应用程序,我看到这个警告在logcat中。此警告不会导致关闭应用程序。一切都运行没有任何问题或interrrupts,但它可能会导致一些问题,这是看不见的在我的应用程序?
继续logcat中:在android.view.ViewRoot< INIT>(ViewRoot.java:261)
atandroid.view.WindowManagerImpl.addView(WindowManagerImpl.java:170)....
这样做的原因的例外是,您的活动
正在通过调用完成()
在活动
或其他异常
被扔在活动
,而在对话框
是显示..
解决方法是调用辞退()
的对话框,你考虑退出活动,比如之前创建在的onPause()
。所有的窗户和放大器;对话应该在离开之前,你不要关闭该对话框,它会给你一个例外Activity.If被关闭。
像下面
@覆盖
保护无效的onStop(){
super.onStop();
如果(对话!= NULL){
如果(dialog.isShowing()){
dialog.dismiss();
}
}
}
What does mean this warning? I develop an android application and i see this warning in the logcat. This warning doesn't lead to close the application. Everything runs without any problems or interrrupts but could it lead some problems which are unseen in my application?
Continue logcat: at android.view.ViewRoot.<init>(ViewRoot.java:261)
atandroid.view.WindowManagerImpl.addView(WindowManagerImpl.java:170)....
The reason for this Exception is, your Activity
is being destroyed by calling either finish()
in Activity
or by some other Exception
is thrown in the Activity
while your Dialog
is showing..
The solution is to call dismiss()
on the Dialog you created in view before exiting the Activity, e.g. in onPause()
. All windows&dialogs should be closed before leaving an Activity.If you dont dismiss the dialog it will give you that exception..
Like below
@Override
protected void onStop() {
super.onStop();
if (dialog!=null) {
if (dialog.isShowing()) {
dialog.dismiss();
}
}
}
这篇关于窗口管理:MainActivity渗漏窗口com.android.internal.policy.impl.PhoneWindow$DecorView@40731aa0这是原来的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!