0

I know there are a lot of question regarding how to run the same asynctask in parallel: what i need is to execute the same asynctask but with different params per task.

I have:

MyTask taskOne = new MyTask();
MyTask taskOne = new MyTask();
taskOne.execute(UrlOne);
taskTwo.execute(UrlTwo);

MyTask have to download the page from the urlone and url two. When one of the two finishes, i kill the other one with cancel(true). But how can i run those thread in parallel?

If i try this, when taskOne ends it just kill taskTwo.

Thanks all for help

Federico Ponzi
  • 2,682
  • 4
  • 34
  • 60

1 Answers1

0

You should have used some synchronization mechanism like a semaphore or a conditionobject.

https://www.youtube.com/playlist?list=PLZ9NgFYEMxp4tbiFYip6tDNIEBRUDyPQK

Federico Ponzi
  • 2,682
  • 4
  • 34
  • 60