Android Week 7

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/8

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

9 Terms

1
New cards

What are coroutines used for in android?

To run tasks in the background (like network calls or file access) without freezing the app.

2
New cards

Why are coroutines important in Jetpack Compose?

They keep the UI smooth by moving slow work (like loading data) off the main thread.

3
New cards

What is GlobalScope in coroutines?

A coroutine scope that lives as long as the app does — not tied to any screen or UI elemen

4
New cards

Why is GlobalScope discouraged for UI-related tasks?

It caBecause it keeps running even if the screen is closed, which can cause memory leaks.

5
New cards

What is LifecycleScope?

Runs in an Activity or Fragment
Cancels when the Activity/Fragment is destroyed
For tasks tied to the screen's lifecycle

6
New cards

Why should LifecycleScope be preferred over GlobalScope?

It cleans up coroutines when the screen closes, which avoids leaks and extra work.

7
New cards

What is LaunchedEffect in Jetpack Compose?

Runs in a Composable
Cancels when Composable leaves the screen
For UI-related side effects tied to composition

8
New cards

What is rememberCoroutineScope used for?

It gives you a coroutine scope you can launch from inside a Composable, like when a button is clicked.

9
New cards

What is viewModelScope?

A coroutine scope that lives as long as the ViewModel — survives screen rotations but cancels when the ViewModel is gone.