Skip to content

profe-PMDM/ViewModel_LiveData_Sample

Repository files navigation

ViewModel_LiveData_Sample

Sample Code for Lesson 8 using ViewModel, LiveData and Data Binding

This repo is a sample code shown in classroom to study ViewModel, LiveData and Data Binding within Android Development. It corresponds to Lesson 8 "App Architecture (UI Layer)" of the module "Multimedia and Mobile Devices Programming". We've developed an app that counts and shows the number of Likes.

In the first commit, we`ve used old patterns to get the solution.

In the second commit, we've added onSaveInstanceState to preserve counts during Configuration Changes.

In the third commit, we've replaced onSaveInstanceState with ViewModel pattern.

In the fourth commit, we've added Data Binding to handle UI.

In the fifth commit, we've added Live Data an Observer pattern to update UI automatically.

In the sixth commit, we've replaced Observer pattern with bidirectional Data Binding.

About

Sample of using ViewModel, LiveData and Data Binding

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages