Android Jetpack Flashcards
(15 cards)
What are Android Jetpack Components?
A group of libraries in Android that helps developers build more robust apps, designed to make app development faster and more maintainable.
What are the categories of Android Jetpack Components?
Components are divided into 4 categories: UI, Behavior, Architecture, and Foundation.
What programming paradigm does Android Jetpack follow?
It follows a reactive programming paradigm, focusing on data streams and changes propagation.
What is the role of ViewModels in Android Jetpack?
ViewModels are responsible for the data model and associated logic, determining how data will be used.
What is LiveData in Android Jetpack?
LiveData is a data holder class that can be observed within a given lifecycle, notifying UI Controllers of changes in data.
What is the purpose of the ViewModel Component?
The ViewModel Component is responsible for loading, preparing, and managing UI-related data without directly interacting with UI Views.
How does ViewModel handle configuration changes?
ViewModels will not be destroyed if their owner is destroyed for a configuration change; a new instance of the owner will reconnect to the existing ViewModel.
What should ViewModels avoid storing?
ViewModels shouldn’t store objects with shorter lifecycles such as Activities, Fragments, or Views to prevent memory leaks.
What is Unidirectional Data Flow (UDF)?
UDF is a principle in modern app architecture that promotes a single direction of data flow throughout the app.
What is the recommended architecture for modern Android apps?
Modern architecture recommends a single Activity app with different screens loaded within the same Activity, promoting separation of concerns.
What is the purpose of onSaveInstanceState()?
onSaveInstanceState() is used for saving persistent UI data (UI state) upon onDestroy calls.
What are some components in the Architecture Category of Jetpack?
Components include Navigation, Paging, and WorkManager.
How can LiveData be used in XML layouts?
LiveData can be referred to directly in the Layout XML file, replacing the setter of the Observer in the Activity class.
What is the Gradle namespace for Jetpack components?
Jetpack components are under the androidx namespace in the Android library.
What is the significance of LifecycleOwner in Observers?
LifecycleOwner can handle lifecycle changes without implementing code inside the Activity/Fragment, notifying Observers only when active.