1/8
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
What are coroutines used for in android?
To run tasks in the background (like network calls or file access) without freezing the app.
Why are coroutines important in Jetpack Compose?
They keep the UI smooth by moving slow work (like loading data) off the main thread.
What is GlobalScope
in coroutines?
A coroutine scope that lives as long as the app does — not tied to any screen or UI elemen
Why is GlobalScope
discouraged for UI-related tasks?
It caBecause it keeps running even if the screen is closed, which can cause memory leaks.
What is LifecycleScope
?
➡ Runs in an Activity or Fragment
➡ Cancels when the Activity/Fragment is destroyed
➡ For tasks tied to the screen's lifecycle
Why should LifecycleScope
be preferred over GlobalScope
?
It cleans up coroutines when the screen closes, which avoids leaks and extra work.
What is LaunchedEffect
in Jetpack Compose?
➡ Runs in a Composable
➡ Cancels when Composable leaves the screen
➡ For UI-related side effects tied to composition
What is rememberCoroutineScope
used for?
It gives you a coroutine scope you can launch from inside a Composable, like when a button is clicked.
What is viewModelScope
?
A coroutine scope that lives as long as the ViewModel — survives screen rotations but cancels when the ViewModel is gone.