Skip to content

Instantly share code, notes, and snippets.

@khunzohn
Last active January 24, 2018 07:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save khunzohn/264a317521ea5d106ac3415cf846b778 to your computer and use it in GitHub Desktop.
Save khunzohn/264a317521ea5d106ac3415cf846b778 to your computer and use it in GitHub Desktop.
public void getUser(String userId) {
getView().showLoading(“fetching user…”);
Subscription sub = userRepository.getUser(userId) 
.subscribeOn(Schedulers.io())
.observeOn(AndroidScheduler.mainThread())
.subscribe(user -> {
getView().stopLoading();
getView().render(user);
},e->{
getView.stopLoading();
getView().renderError(e);
})
compositeSubscription.add(subscription);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment