I am running three AsyncTask parallel. (at least I think they are being executed parallel).
What I am doing is, I am using SAX Parser to parse data from three different XML feeds, the AsyncTask object is created three times inside a loop, each time with different URL.
for (int i = 0; i < URLs.length; i++){
GetNews blog = new GetNews(i);
blog.execute();
}
When this code executes, three Asynctasks are executed. I want to know how to monitor each task separately, because I want to set the value of root Element, for example,
when Task1 is executed, rootElement = "entry"
,
when Task2 is executed rootElement = "post"
and so on.. Here is what I have tried. for (int i = 0; i < URLs.length; i++){ if (i==0) rootElement = "entry" else if (i==1) rootElement = "post" else if (i==2) rootElement = "channel" GetNews blog = new GetNews(i); blog.execute(); }
but the entire code is executed in few seconds and the final rootElement
value is set to the last one.
How can I monitor each task separately to set the value of the element for based on the task running.