Skip to main content


Showing posts from June, 2014

AsyncTask in Android.

AsyncTask  is one Class which is used to perform background processes without having threads. For an AsyncTask is having 4 steps. onPreExecute, doInBackground, onProgressUpdate, onPostExecute

onPreExecute method is invoked first while calling the AsyncTask. Here comes the fuctions which are to be performed at the starting. The functions such as  showing progress dialog etc..

doInBackground method will execute after onPreExecute method. Here comes the functions which are to be done in background. The functions such as downloading files uploading files etc...

onProgressUpdate method is invoked while the progress is changed. Here we will write the code to perform the action while changing the progress.

onPostExecute method is invoked after the doInBackground method is completed. This method will execute at last. Here we will write code to perform the actions at last. The functions such as progress dialog dismiss, parse the result, redirection to another page etc..

Here is One Example: