In this recipe, we are going to explore how to use the coroutines framework in order to run asynchronous operations concurrently, and learn how to handle the results they return properly. We are going to schedule two tasks and run them in the background using two coroutines. The first task is going to be responsible for displaying the progress-bar animation. The second one is going to simulate long-running computations. In the end, we are going to print the results returned by the second task to the console.
Using coroutines for asynchronous, concurrent tasks execution with results handling
Getting ready
The first step to start working with Kotlin Coroutines is to add a core framework dependency to the project:
implementation...