Skip to content

Instantly share code, notes, and snippets.

@sanogueralorenzo
Last active November 6, 2018 14:47
Show Gist options
  • Save sanogueralorenzo/778419251a2023717bc05b518dc5be08 to your computer and use it in GitHub Desktop.
Save sanogueralorenzo/778419251a2023717bc05b518dc5be08 to your computer and use it in GitHub Desktop.
class PostListActivity : AppCompatActivity() {
@Inject
lateinit var viewModelFactory: ViewModelProvider.Factory
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_post_list)
getAppInjector().inject(this)
val vm = ViewModelProviders.of(this, viewModelFactory)[PostListViewModel::class.java]
vm.posts.observe(this, Observer(::updatePosts))
}
//...
}
@mehdiyari
Copy link

PostListViewModel have 2 inputs in constructor ! idont see in activity or your di or any files in your medium example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment