Skip to content

Instantly share code, notes, and snippets.

@demonar
Created October 9, 2019 00:21
Show Gist options
  • Save demonar/54a21933623e8a4ddbe9f934bb94afcf to your computer and use it in GitHub Desktop.
Save demonar/54a21933623e8a4ddbe9f934bb94afcf to your computer and use it in GitHub Desktop.
//let's say that we have a login method
val call = service.login(username, pass)
//we call the new enqueue
call.enqueue { result ->
when(result) {
is Result.Success -> {
//myData will have the type passed from the service method
val myData = result.response.body()
}
is Result.Failure -> {
Log.d("MyAndroidApp", result.error.toString())
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment