Android Async Task With Example Use Case
Why Async Task Androids Application UI is single threaded and executed by one Thread called UI Thread. If we want to execute slightly long running processing by UI Thread then the Application would become unresponsive and the User experience will not be great. AsyncTask enables proper and easy use of the UI thread. This class allows to perform background operations and publish results on the UI thread. An asynchronous task is defined by 3 generic types, called Params , Progress and Result , AsyncTask have Four Main Method... onPreExecute() doInBackground() onProgressUpdate() onPostExecute() onPreExecute() This task is run on the main UI Thread, This method can show update the UI on the Activity hinting the start of the background process, like updating the UI with Progress Indicator. doInBackground(Params......) Invoked on the Background Thread.This method is executed right after onPreExecute() method is finished. Code for long running operations like up