Skip to content

Explains the lifecycle of an AsyncTask when the activity is in OnPause state or when the activity gets destroyed or when the application gets destroyed. Uses Weak reference of the host Activity to avoid memory leak issues in case the user destroys the host activity but the async task is still functioning.

Notifications You must be signed in to change notification settings

vyas00/AsyncTask-Lifecycle

Repository files navigation

AsyncTask-Lifecycle

Asynctask lifecycle This android application describes the lifecycle of an async task in different situations. What happens to a current running asyncTask if the activity gets destroyed, paused or the application gets killed. Also it discribes the use of Weak references and Strong references in android and the solves the problem of Memory Leak. Uses weak reference of the main activity so that memory leaks do not occurs even when the asyncTask is running but the host activity has been destroyed. Also uses the task.cancel() method of async task to cancel the task

About

Explains the lifecycle of an AsyncTask when the activity is in OnPause state or when the activity gets destroyed or when the application gets destroyed. Uses Weak reference of the host Activity to avoid memory leak issues in case the user destroys the host activity but the async task is still functioning.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages