RxJava Scheduler to observe on main thread
Convert the Observable
to a BlockingObservable
via .toBlocking()
; this gives you blocking methods to wait for completion, get one item, etc.
For RxJava2 use "blockingSubscribe()
"
Flowable.fromArray(1, 2, 3)
.subscribeOn(Schedulers.computation())
.blockingSubscribe(integer -> {
System.out.println(Thread.currentThread().getName());
});