0

I am using Anko library to do some background task, I have a doAsync running in a foreground service. At the same, I am updating the recyclerview by fetching data from the database. But the problem is when the foreground service doAsync is running, the recyclerview updating doAsync is not called.

I have no clue why it's not calling, can't I run multiple doAsync at the same time?

Jeeva
  • 3,975
  • 3
  • 23
  • 47

1 Answers1

1

Asynchronous vs synchronous execution, what does it really mean?

doasync runs multiple tasks in a 'first in first executed'(what you explained) sequence in one background thread(not multiple threads); so like asynctask by creating multiple instances of it you're just creating multiple tasks;

you need to start a new thread for each of your tasks if you want all the tasks to run asynchronously relative to each other;

kamyar haqqani
  • 748
  • 6
  • 19