Skip to content

Instantly share code, notes, and snippets.

@gfreivasc
Created April 7, 2019 15:58
Show Gist options
  • Save gfreivasc/9b2e6e8c022b24a202451821a985b4f6 to your computer and use it in GitHub Desktop.
Save gfreivasc/9b2e6e8c022b24a202451821a985b4f6 to your computer and use it in GitHub Desktop.
v 3
class MainActivity : ComponentActivity(R.layout.activity_main) {
private val viewModel = GenericProvider.provide { MainViewModel() }
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
textView.text = "${viewModel.count}"
button.setOnClickListener {
viewModel.inc()
textView.text = "${viewModel.count}"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment