问题描述曾几何时,我们用原来的办法使用Handler时会有下面一段温馨的提示:This Handlerclassshould bestaticorleaks might occur下面是更详细的说明(Android Studio上的警告,不知道Eclipse上是否相同)Since this Handler is declared as an inner class, it may prevent the outer class from being garbage collected. If the Handler is using a Looper or MessageQueue for a thread other than the main thread, then there is no issue. If the Handler is using the Looper or MessageQueue of the main thread, you need to fix your Handler declaration, as follows: Declare the Handler as a static class; In the outer class, instantiate a WeakReference to the outer class and pass
...
继续阅读
(63)