

Syntax of AsyncTask class: private class DownloadFilesTask extends AsyncTask Executions of AsyncTask class from main thread: The parameters are the following AsyncTask. This method is called automatically after the doInBackground method finished its work. The onPostExecute() method of this class synchronizes itself again with the main UI thread and allows it to make some updating.

This class will executes everything in doInBackground() method inside of other thread which doesn’t have access to the GUI where all the views are present. For providing a good user experience in our application we need to use AsyncTasks class that runs in a separate thread. If we need to perform long tasks/operations then our main thread is blocked until the corresponding operation has finished.
