Skip to content

Instantly share code, notes, and snippets.

@julianfalcionelli
Last active May 16, 2017 20:16
Show Gist options
  • 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