`Day40` - Reviewed mvvm basics with some googling ...
# 100daysofkotlin-2021
j
Day40
• Reviewed mvvm basics with some googling (1) (2) (3) ◦ Actually I didn’t get why MVVM is so good but this explanation was good. (“Now if one of our activity has some data on it fetched from server, but if for some reasons (for example orientation changes) the activity is recreated it will fetch the data from the server again. Fetching the same data from the server is a waste of resources. An efficient solution here is to separate the view data ownership from UI Controller logic.“) • Rough planning for tomorrow’s task ◦ should add dependencies for.. viewmodel? lifecycle? whatsoever ◦ should create Repository class (use LiveData* *for observing response) ◦ should create ViewModel class (Store & manage UI-related data in a lifecycle conscious way. Allows data to survive configuration changes) ◦ It’s basically re-organizing what I’ve done till now. (And that is not easy..) I guess I should create a view model, pull off the parts of MainActivity into view model and etc.
Self-Comment
• Not much done today solely, but I know that this googling time will help myself tomorrow…
Goals Tomorrow
• Location api demo app - add distance checking feature. ◦ calculate distance in location callback ◦ create subject (maybe in boolean..?) -> subscribe that subject -> change textview according to that subject • Refactoring into MVVM
🔥 1