Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • the weak reference idea is indeed a very smart one, this would allow the object be easily garbage collected when necessary. thumbs up samo! Commented Feb 18, 2014 at 14:49
  • Why static is used here ? What if I use MyFragmentActivity mActivity = this ? With out static & WeakReference Commented May 29, 2017 at 5:40
  • Static reference is pretty bad engineering, you should rather tie your asynchtask to the lifecycle and cancel when its necessary Commented Jun 6, 2018 at 9:10
  • A weak reference is still a dumb idea. The weak reference naming misleads a lot of people. Just to be clear; if there is a reference to a weak reference object your view will still leak even if the view is destroyed Commented Jan 17, 2022 at 20:21