Original address: http://www.cnblogs.com/royenhome/archive/2011/05/20/2051879.html
Exception Scenario:
There are often time-consuming tasks that need to be handled in the application, such as reading large files, accessing network resources, and so on. In order to avoid the bad user experience due to the death of the program, usually we can solve the problem through thread +handler or Android-provided asynctask, and generally use the prompt control such as ProgressDialog to inform the user of the current program progress. The exceptions described in the title often appear in such scenarios and often obscure the real culprit that caused the exception.
Cause of the problem:
From the description of the exception, the general meaning is that there is a disclosure of the window handle, that is, failure to destroy a phonewindow in time. And that often misleads us by putting too much effort into finding so-called memory leaks. In fact, there is a situation where we have a serious exception due to some improper operation in the non-main thread, forcing the current activity to be closed. While shutting down, but failed to call dismiss in time to de-progressdialog, and so on, so that the system throws the error in the title, and masks the real cause of the error of the exception information.
One of the workarounds:
This solution does not really solve the problem, but to a certain extent, it can reveal the abnormal information that really leads to the error. That is, overriding the activity's OnDestroy method, calling dismiss in the method to dismiss the reference to ProgressDialog, and so on.