Skip to content

Instantly share code, notes, and snippets.

@raghunandankavi2010
Created February 12, 2021 05:20
Show Gist options
  • Save raghunandankavi2010/3495b8cf78ab1cb0d7d2ce50115f09b3 to your computer and use it in GitHub Desktop.
Save raghunandankavi2010/3495b8cf78ab1cb0d7d2ce50115f09b3 to your computer and use it in GitHub Desktop.
Fragment A Observing Livedata
viewModel.vendor.observe(viewLifecycleOwner) {
it?.let { result ->
when (result) {
is Result.Success -> {
// do something on success
}
is Result.Error -> {
// print stack trace
}
is Result.Loading -> {
// dismiss loading
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment