A new way to create a ViewModel, CreationExtras?
Androidx-Lifecycle has recently moved to version 2.5.0, one of the most important changes being the introduction of the concept of CreatioinExtras. One sentence summarizing the role of CreationExtras: helps us gracefully get initialized parameters when creating ViewModel s
1. Status Quo
Review how ViewModel s have been created so far
val v ...
Posted by Trium918 on Sun, 06 Mar 2022 19:15:30 +0100
MVC, MVP and MVVM architecture pattern & ViewModel
Before learning viewModel, we need to understand MVC, MVP and MVVM architecture patterns.
A simple understanding can be viewed Illustration of MVC, MVP and MVVM.
Another super good article: Design architecture of Android App: MVC,MVP,MVVM and architecture.
MVC
Illustration:
It is the abbreviation of model view controller. It is a softw ...
Posted by tablex on Mon, 31 Jan 2022 19:32:25 +0100
Principle analysis of JectPack components -- ViewModel
In the JectPack component, ViewModel is mainly used to encapsulate the data related to the interface. Similarly, ViewModel has the ability of life cycle awareness. It always exists in memory before the destruction of Activity or Fragment onDetach; Especially after system configuration changes such as screen rotation, the interface data saved by ...
Posted by techrat on Tue, 25 Jan 2022 07:48:49 +0100