Skip to content

abhineshchandra1234/ViewModelApp

Repository files navigation

ViewModel in kotlin

This project explains with a simple example of how to implement the view model in kotlin

  • ViewModel handles all the data for the UI
  • it is created when an activity is created. It survives configuration changes.
  • when using ViewModel and suppose configuration changes or you switch apps, old data will remain saved in ViewModel
  • It is destroyed only when activity is destroyed or when you press the back button and the application is closed and activity is destroyed.

lifecycle of a ViewModel

ViewModel lifecycle

App Screenshots

potrait landscape

References

Releases

No releases published

Packages

No packages published

Languages