AsyncTask empowers fitting and simple utilization of the UI string. This class permits to perform background operations and show results on the UI thread.
When we use AsyncTasks, than it only execute on a single background thread. Beginning with DONUT, this was changed to a pool of strings permitting numerous tasks to work in parallel. Beginning with HONEYCOMB, assignments are executed on a single string to stay away from regular application errors created by parallel execution.
AsyncClass async=new AsyncClass(;)
if (Build.VERSION.SDK_INT>=Build.VERSION_CODES.HONEYCOMB)
{
async.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR,"");
} else
{
async.execute(""); //execute serially
}
.execute always execute a asynctask serially,which means one by one.
executeOnExecutor it works only in new versions ,above HONEYCOMB and by using executeOnExecutor you can execute multipleasync task parallely ..
When we use AsyncTasks, than it only execute on a single background thread. Beginning with DONUT, this was changed to a pool of strings permitting numerous tasks to work in parallel. Beginning with HONEYCOMB, assignments are executed on a single string to stay away from regular application errors created by parallel execution.
AsyncClass async=new AsyncClass(;)
if (Build.VERSION.SDK_INT>=Build.VERSION_CODES.HONEYCOMB)
{
async.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR,"");
} else
{
async.execute(""); //execute serially
}
.execute always execute a asynctask serially,which means one by one.
executeOnExecutor it works only in new versions ,above HONEYCOMB and by using executeOnExecutor you can execute multipleasync task parallely ..
0 comments:
Post a Comment