Saturday, 9 July 2022

Android Jetpack

Jetpack is a collection of useful Android libraries.  A typical Android app will have multiple layers: a UI layer, an (optional) domain layer and a back-end ("data") layer. A candidate for code in the domain layer would be complex business logic that is used across multiple ViewModels.

LiveData and ViewModel are examples of JetPack components. LiveData is interesting, it follows the Observer pattern and notifies Observer objects when the underlying data changes. This way you don't need to write update code in the UI every time the underlying application data changes. Observers have a void return onChanged method that gets called every time data is changed.

No comments: