Solution of android.view.windowleft in Android

Solution of android.view.windowleft in Android

Literally, window leaked means that a form leaks, which is what we often call a memory leak. Why does the form leak?

Causes:

We know that every Android activity has a WindowManager form manager. Similarly, the dialog box and popupwindow built on an activity also have a corresponding WindowManager form manager. Because the dialog box and popupwindow cannot exist separately from the activity, when a dialog or popupwindow is displaying, we finish() the activity hosting the dialog (or popupwindow), we will throw the window left exception, because no one can attach to the WindowManager of this dialog (or popupwindow), So its form manager has leaked.

resolvent:

Before closing an activity, make sure that the dialog or popupwindow attached to it has been closed.

For example:

Thank you for reading, hope to help you, thank you for your support to this site!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>