Last active
December 11, 2021 10:52
-
-
Save hiteshchopra11/3d35b7b0bb5bb755eba7a49866431c63 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 = MainActivityViewModel() | |
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