Android AsyncTask

“AsyncTask enables proper and easy use of the UI thread. This class allows to perform background operations and publish results on the UI thread without having to manipulate threads and/or handlers.” –

Async task class definition

starting task


Or we can execute directly



ref :

Author: bm on July 13, 2016
Category: Android

3 thoughts on “Android AsyncTask

  1. The UI element you are updating might become invalid by the time your onPostExecute() will be called, a better approach will be to pass the weakreference of the view you want to update and check if it is still valid before doing some operation on it.

    Something like this:

    You can pass the view itself which you would want to update instead of context, say like ProgressBar and store it in weakreference.

Your comment:

Your Name


Last articles