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, eg 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();
}
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.