title: RxJava Run A Task on another thread
body: <p>I'm using RxJava3 Observers and Observables. But i have a problem.</p>
  <p>I have attached a screenshot below, please see the Toast on the bottom. I used <code>Thread.currentThread().toString()</code> And i got the Main, 5, Main output</p>
  <p><a href="https://i.stack.imgur.com/l8pfZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/l8pfZ.png" alt="Screenshot1" /></a></p>
  <p>Now, here's my observable code</p>
  <pre><code>private void start(){
          reactiveDataSource.getObservableList().subscribeOn(Schedulers.io())
          .observeOn(AndroidSchedulers.mainThread())
          .subscribe(new Observer&lt;String&gt;() {
              @Override
              public void onSubscribe(Disposable d) {
                  Log.e(TAG, &quot;subscribed in observable list&quot;);
                  
              }
              
              @Override
              public void onNext(String item) {
                  Log.e(TAG, &quot;in observable list -&gt;&quot; + item);
                  if(item == &quot;D&quot;){
                      Toast.makeText(getApplicationContext(), Thread.currentThread().toString(), Toast.LENGTH_SHORT).show();
                  } else {
                      if(item == &quot;E&quot;){
                          Toast.makeText(getApplicationContext(), &quot;E&quot;, Toast.LENGTH_SHORT).show();
                      } else {
                          if(item == &quot;F&quot;){
                              Toast.makeText(getApplicationContext(), &quot;F&quot;, Toast.LENGTH_SHORT).show();
                          }
                      }
                  }
                  
              }
              
              @Override
              public void onError(Throwable e) {
                  Log.e(TAG, &quot;error in observable list &quot; + e.getMessage());
                  Toast.makeText(getApplicationContext(), e.toString(), Toast.LENGTH_SHORT).show();
                  
              }
              
              @Override
              public void onComplete() {
                  Log.e(TAG, &quot;in observable list complete&quot;);
                  Toast.makeText(getApplicationContext(), &quot;Complete!!!&quot;, Toast.LENGTH_SHORT).show();
                  
              }
          });
      }
  </code></pre>
  <p>ReactiveDataSource.java:</p>
  <pre><code>public Observable&lt;String&gt; getObservableList() {
          List&lt;String&gt; createdList = new ArrayList&lt;&gt;();
          createdList.add(&quot;D&quot;);
          createdList.add(&quot;E&quot;);
          createdList.add(&quot;F&quot;);
          createdList.add(&quot;G&quot;);
          return Observable.fromIterable(createdList);
      }
  </code></pre>
  <p>I want to run my task inside <code>onNext()</code> method in the background thread. How do i achieve this?</p>
  <p>My Main UI thread still freezes during intensive tasks and <code>Thread.sleep(5000); </code> makes my MainUI freeze even if i placed this code on filter() operator of rxjava, trying to test and freeze my new thread.</p>
  <p>Is there something I'm doing wrong?</p>