Created
October 9, 2019 00:21
-
-
Save demonar/54a21933623e8a4ddbe9f934bb94afcf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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