I have multiple asynctasks in my application, I want to execute it when a specific condition is satisfied. For example,
class Task1 extends AsyncTask...
class Task2 extends AsyncTask..
class Task3 extends AsyncTask...
I have a while loop which is used to iterate some values from a map. eg:
while(iterator.next())
{
Map.Entry pair = (Map.Entry) it.next();
String title = pair.getKey().toString();
if(title.equals("one"))
{
//execute task1;
}else if(title.equals("two"))
{
//execute task2;
}
etc..
}
This is a sample code i currently used. Each Task contains a progress dialog, which is starting on onPreExcecute() and dismissed on onPostExecute().
My Problem is that I want to execute only one task at a time. In my code all tasks are started at same time and progress dialog will overlap each other. So there is any way to execute only one task at a time, Thanks is advance.