Skip to content

Instantly share code, notes, and snippets.

@hadilq
Created February 5, 2020 17:43
Show Gist options
  • Save hadilq/1159f45f44f00f9b6439c92ca1587a4b to your computer and use it in GitHub Desktop.
Save hadilq/1159f45f44f00f9b6439c92ca1587a4b to your computer and use it in GitHub Desktop.
RxViewModelActivitySample
class RxViewModelActivitySample : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.main_activity)
val viewModel = ViewModelProvider(this).get(RxViewModelSample::class.java)
(viewModel.stringEmitter.observe()) { testString ->
/* use it here */
}
(viewModel.extendedStringEmitter.observe()) { testString ->
/* use it here */
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment