Member-only story
Coroutines Cheat Sheet for Android Developers
Hola, you lovely devs! 👩🏻💻
Welcome to yet another blog of our ongoing Android Interview Prep series. In this blog, we’ll be discussing about a really important concept in Android: Kotlin Coroutines. This coroutine cheat sheet serves as a quick refresher for anyone familiar with this powerful tool.
And here’s a special treat for our non-Medium members: we’re offering free access to this blog! Just follow this link — because your curiosity and passion for coding should never be limited! 😉😉
Let’s get the party started…
- Launching a Coroutine (
launch
)
launch
is used to start a coroutine without expecting a result.- It’s usually used when you just want to fire and forget a task.
Example Usage:
2. Getting a Result with async
- If you need a result from a coroutine,
async
is your friend. async
returns aDeferred
object, which you canawait
to get the result.