Skip to content

Instantly share code, notes, and snippets.

@julianfalcionelli
Last active May 16, 2017 20:16
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 julianfalcionelli/10f390ef4953212442320819795bf3dc to your computer and use it in GitHub Desktop.
Save julianfalcionelli/10f390ef4953212442320819795bf3dc to your computer and use it in GitHub Desktop.
Single Example
//---
Single.create((SingleOnSubscribe<String>) e -> e.onSuccess(makeBlockingTask()))
.subscribeOn(Schedulers.io()) //Run on IO Thread
.observeOn(AndroidSchedulers.mainThread()) //Run on UI Thread
.doOnSubscribe(__ -> showLoadingIndicator())
.doFinally(() -> hideLoadingIndicator())
.subscribe(this::processResult,
this::processError);
//---
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment