Skip to content

Instantly share code, notes, and snippets.

@psteiger
Last active July 1, 2019 00:10
Show Gist options
  • Save psteiger/b46003febdee82ad6fccb5e04bb3fd2a to your computer and use it in GitHub Desktop.
Save psteiger/b46003febdee82ad6fccb5e04bb3fd2a to your computer and use it in GitHub Desktop.
usersLiveData.observe(viewLifecycleOwner, Observer { resource ->
resource.onSuccess { userList: HashMap<String, User> ->
usersLoaded(user)
}.onLoading { partialUserList: HashMap<String, User>? ->
usersAreLoading(partialUserList)
}.onFailure { cause: Throwable? ->
userLoadFailed(cause)
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment