Skip to content

Instantly share code, notes, and snippets.

@AkshayChordiya
Last active July 5, 2017 11:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AkshayChordiya/e9d5aec2b0dc1016b75ac001f68389c0 to your computer and use it in GitHub Desktop.
Save AkshayChordiya/e9d5aec2b0dc1016b75ac001f68389c0 to your computer and use it in GitHub Desktop.
Main Activity with ViewModel instance
class MainActivity : LifecycleActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
// Get the ViewModel instance
val simpleViewModel = ViewModelProviders.of(this).get(SimpleViewModel::class.java)
val data = simpleViewModel.getDataList()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment