Skip to content

Instantly share code, notes, and snippets.

@louis993546
Created April 10, 2019 21:03
Show Gist options
  • Save louis993546/cda6c55bfdd6fceabda994ffbe8f0e02 to your computer and use it in GitHub Desktop.
Save louis993546/cda6c55bfdd6fceabda994ffbe8f0e02 to your computer and use it in GitHub Desktop.
class SomethingActivity extends AppCompatActivity {
@Override
void onCreate() {
super.onCreate();
setContentView(R.layout.activity_something);
}
@Override
void onResume() {
retrofitService.someApiEndpoint().enqueue(this);
}
@Override
void onResponse(Call<Something> call, Response<Pojo> response) {
//TODO handle your api call here, set some text field, hide some other field
}
@Override
void onFailure(Call<Something> call, Throwable t) {
//TODO show some error message, or a toast, or throw it to error logging tool
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment