android 图片异步加载 线程的问题

http://eclipsesource.com/blogs/2012/07/31/loading-caching-and-displaying-images-in-android-part-1/

弱引用,传入ImageView解决


Note how we use a WeakReference to hold onto the ImageView. When the user shuts down the application or simply rotates the device the current Activity is closed and/or restarted. The previous Activity can not be disposed of while we are still holding references to it, so we are facing a potential memory leak. The most common solution to this problem is to use a WeakReference when holding onto the parent Activity. An object referenced by a weak reference can still be garbage collected when no other soft or weak reference points to it. Once we have lost the reference to the previous Activity, it is the responsibility of the new parent Activity to re-inject the target View/Activity for our image. To get further help one could use the Loaders class, which helps in surviving the Activity switch.

你可能感兴趣的:(android 图片异步加载 线程的问题)