daily pastebin goal
45%
SHARE
TWEET

Untitled

a guest Jul 12th, 2018 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Observable.create(new ObservableOnSubscribe<Integer>() {
  2.     @Override
  3.     public void subscribe(ObservableEmitter<Integer> e) throws Exception {
  4.         e.onNext(1);
  5.         e.onNext(2);
  6.         e.onError(new Throwable("Error occurred"));
  7.     }
  8. }).onErrorResumeNext(new Function<Throwable, ObservableSource<? extends Integer>>() {
  9.     @Override
  10.     public ObservableSource<? extends Integer> apply(@NonNull Throwable throwable) throws Exce
  11.         Log.d(TAG, "apply e=" + throwable.getMessage());
  12.         return Observable.just(3, 4);
  13.     }
  14. }).subscribe(new Observer<Integer>() {
  15.     @Override
  16.     public void onSubscribe(Disposable d) {
  17.         Log.d(TAG, "onSubscribe");
  18.     }
  19.     @Override
  20.     public void onNext(Integer value) {
  21.         Log.d(TAG, "onNext value=" + value);
  22.     }
  23.     @Override
  24.     public void onError(Throwable e) {
  25.         Log.d(TAG, "onError e=" + e.getMessage());
  26.     }
  27.     @Override
  28.     public void onComplete() {
  29.         Log.d(TAG, "onComplete");
  30.     }
  31. });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top