Recall & Review
beginner
What is LiveData in Android development?
LiveData is a data holder class that can be observed. It respects the lifecycle of app components like activities and fragments, so it only updates UI when the component is active.Click to reveal answer
beginner
How does LiveData help with UI updates?
LiveData automatically notifies observers when the data changes, so the UI updates without manual calls. It also avoids crashes by updating only when the UI is active.
Click to reveal answer
beginner
What is the role of
Observer in LiveData?An Observer watches LiveData for changes. When LiveData changes, the Observer's callback runs to update the UI or perform actions.
Click to reveal answer
intermediate
Why should LiveData be used with ViewModel?
ViewModel holds LiveData to keep data during configuration changes like screen rotation. This keeps UI data safe and consistent.
Click to reveal answer
intermediate
What happens if an observer is inactive in LiveData?
LiveData does not send updates to inactive observers. This prevents unnecessary UI updates and potential crashes.
Click to reveal answer
What does LiveData automatically respect in Android?
✗ Incorrect
LiveData updates observers only when their lifecycle is active, preventing crashes and wasted resources.
Which class is commonly used to hold LiveData for UI data?
✗ Incorrect
ViewModel holds LiveData to survive configuration changes and keep UI data consistent.
What triggers the Observer's callback in LiveData?
✗ Incorrect
Observers react only when LiveData's data changes.
What happens if LiveData has no active observers?
✗ Incorrect
LiveData keeps data but does not send updates until an observer becomes active.
Which of these is NOT a benefit of using LiveData?
✗ Incorrect
LiveData removes the need for manual UI update calls by notifying observers automatically.
Explain how LiveData helps manage UI updates in Android apps.
Think about how LiveData only updates UI when the screen is visible and active.
You got /4 concepts.
Describe the relationship between LiveData and ViewModel in Android architecture.
Consider how data stays safe when the screen rotates.
You got /4 concepts.