LiveData
What is LiveData?
- Ensures the UI matches the data state
- One of the greatest things about using the reactive approach is that you don’t need to update the UI every time the data changes. Instead, the active observers are notified for data changes and they update the UI. This saves a lot of manual updates and time developing an application.
- Up to date data
- If an activity goes in the background and then comes back to the screen, its observers are notified if there are changes in the data. This way the observers update the UI of the activity with the newest data available.
- No memory leaks
- Observers are bound to specific lifecycle objects and clean up themselves after the lifecycle is destroyed.
- No crashes due to stopped activities
- If an activity is inactive, then the observers in the activity don’t receive LiveData events because LiveData respects the lifecycle of the app components.
LiveData works great in combination with the other Architecture Components. In the next chapters we will see examples of writing SQL queries which return LiveData objects and examples of using LiveData in ViewModel and Repository.
Letzte Beiträge
Share :
Share :
Weitere Beiträge
Dependency Injection with Spring 5
As we learned in the previous chapter dependency injection is a very powerful technique. DI is provided by the Spring 5 Framework implementation of the Inversion of Control (IoC) principle.
Machine learning concepts. Data preparation
Each machine learning process related to the use of neural networks consists of at least two parts. The first part is related to data loading and preparation for training.
6 Fragen an unseren Senior Consultant Dominique
Heute möchten wir euch unseren IT-Berater und Entwickler Dominique vorstellen. Er ist seit November 2020 Teil unseres Teams und Spezialist in Java, Spring, Microsoft und Enterprise.