Sample project shows you how to communicate with Activity from an AsyncTask by making WeakReference to Activity.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.idea
app
gradle/wrapper
.gitignore
README.md
build.gradle
gradle.properties
gradlew
gradlew.bat
settings.gradle

README.md

WeakReferenceSample

Sample project showing how to do communication between AsyncTask and activity through a weak reference to avoid memory leak. This sample project will demonstrate how to make reference to Activity-like Component that is under frequent state changes. The solution is to create WeakReference to Activity, so the GC can free up the memory whenever it finds the Activity scope is reached to its end.