Define AsyncTask?How many methods are there and how parameters work in it?

Answer: 
The AsyncTask class is a way to achieve multi-threading in android application, where multiple tasks can be run at a time. It synchronizes with the main thread. It also supports reporting progress of the running tasks.

There are four methods in Async Task:
1. onPreExecute()
2. doInBackground()
3. onUpdateProgress()
4. onPostExecute()
 

The three types of parameters in AsyncTask:
1. Params: the type of the parameters sent to the task upon execution.
2. Progress: the type of the progress units published during the background compu
tation.
3. Result: the type of the result of the background computation.

No comments:

Post a Comment