Skip to content

Instantly share code, notes, and snippets.

@mantisbayne
Created November 27, 2019 16:24
Show Gist options
  • Save mantisbayne/a01dd0521f646406b8167d16a6f82e9f to your computer and use it in GitHub Desktop.
Save mantisbayne/a01dd0521f646406b8167d16a6f82e9f to your computer and use it in GitHub Desktop.
@Injectable(ExampleModules::class)
class ExampleActivity : FragmentActivity() {
// Assuming you have set up your Presenter or another class that uses ViewModel (if using MVVM)
// This example uses MVP, but MVVM only requires a few more steps
val presenter: ExampleViewModel by viewModel()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_quotes)
presenter.getAll().observe(this, Observer<List<Example>> { examples ->
// .. what we want to do when we get everything
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment