Skip to content

Instantly share code, notes, and snippets.

@tfcporciuncula
Created March 20, 2019 19:01
Show Gist options
  • Save tfcporciuncula/9e3ca257cce46d78481a12309c0bc18e to your computer and use it in GitHub Desktop.
Save tfcporciuncula/9e3ca257cce46d78481a12309c0bc18e to your computer and use it in GitHub Desktop.
BestPostActivity.kt
private val viewModel by lazy {
// this is what we had
//ViewModelProviders.of(this, injector.bestPostViewModelFactory()).get(BestPostViewModel::class.java)
// this is what we want now
val viewModelFactory = injector.with(BestPostModule(myIntFromView = 10)).bestPostViewModelFactory()
ViewModelProviders.of(this, viewModelFactory).get(BestPostViewModel::class.java)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment