Skip to content

Instantly share code, notes, and snippets.

@b00sti
Created April 28, 2017 14:26
Show Gist options
  • Save b00sti/48ca9eece6a2eb5b928936f97e4e0d15 to your computer and use it in GitHub Desktop.
Save b00sti/48ca9eece6a2eb5b928936f97e4e0d15 to your computer and use it in GitHub Desktop.
UserService apiService = retrofit.create(UserService.class);
String username = "b00sti";
Call<User> call = apiService.getUser(username);
call.enqueue(new Callback<User>() {
@Override
public void onResponse(Call<User> call, Response<User> response) {
int statusCode = response.code();
User user = response.body();
}
@Override
public void onFailure(Call<User> call, Throwable t) {
// Do something if error occurs
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment