/*
  When the button is clicked it will log the following after 5 seconds.
      06-13 10:22:46.423 16707-16707/? D/RxAndroidSamples: onNext(one)
      06-13 10:22:46.423 16707-16707/? D/RxAndroidSamples: onNext(two)
      06-13 10:22:46.423 16707-16707/? D/RxAndroidSamples: onNext(three)
      06-13 10:22:46.423 16707-16707/? D/RxAndroidSamples: onNext(four)
      06-13 10:22:46.423 16707-16707/? D/RxAndroidSamples: onNext(five)
      06-13 10:22:46.423 16707-16707/? D/RxAndroidSamples: onCompleted()
  */
  void onRunSchedulerExampleButtonClicked() {
    sampleObservable()
        // Run on a background thread
        .subscribeOn(AndroidSchedulers.from(backgroundLooper))
        .observeOn(AndroidSchedulers.mainThread()) // Be notified on the main thread
        .subscribe(
            new Subscriber<String>() {
              @Override
              public void onCompleted() {
                Log.d(TAG, "onCompleted()");
              }

              @Override
              public void onError(Throwable e) {
                Log.e(TAG, "onError()", e);
              }

              @Override
              public void onNext(String string) {
                Log.d(TAG, "onNext(" + string + ")");
              }
            });
  }