Reputation: 1692
So I have this bgTask class that extends AsyncTask, and I call the constructor once. But then I call bgTask.execute() inside a for loop. Do the threads run synchronously in this case? And I do use the onPostExecute method inside the class.
BgTask bgTask = new BgTask();
for (int i = 0; i < 10; i++) {
bgTask.execute();
}
Upvotes: 0
Views: 71
Reputation: 294
when you call execute it runs the AsyncTask immediately. If you need a group of threads to behave a certain way then I would suggest reviewing Java's Executors specifically Thread Pools.
Upvotes: 2