All about Coroutines…

<p>Hello people, we are back with one more article and I know you&rsquo;ve read the title already. In this article I&rsquo;ll try to cover all the important questions related to coroutine. So without wasting any time, let&rsquo;s dive in.</p> <h1>What are Coroutines?</h1> <p>Coroutines are a design pattern for writing asynchronous program in android which is helpful for running multiple tasks concurrently.</p> <h1>How are Coroutines different from threads?</h1> <p>Following are the difference between coroutines and threads.</p> <ol> <li>Threads are not lifecycle aware&nbsp;<em>i.e.</em>&nbsp;they are not aware of activity, fragment or view model where as coroutines are life cycle aware and can be launched through&nbsp;<em>GlobalScope</em>,&nbsp;<em>lifeCycleScope</em>&nbsp;or&nbsp;<em>viewModelScope</em>.</li> </ol> <p><a href="https://medium.com/@saurav_suman/all-about-coroutines-b24f3fb9d7f0"><strong>Click Here</strong></a></p>
Tags: Coroutines