Last active
December 11, 2021 10:50
-
-
Save hiteshchopra11/e7afcc2394a659549da6d7b9d7545401 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val viewModel = ViewModelProvider(this)[MainActivityViewModel::class.java] | |
findViewById<Button>(R.id.btn_increment).setOnClickListener { | |
viewModel.incrementByOne() | |
} | |
viewModel.counterLiveData.observe(this) { counter -> | |
findViewById<TextView>(R.id.tv_counter).text = "$counter" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment