RxJava scheduler to watch the main thread
If I write something like this, then both the activity and notification are included in the current stream ...
Observable.fromCallable(() -> "Do Something")
.subscribe(System.out::println);
If I perform an operation on a background thread like this, then both the operation and notification are on the background thread ...
Observable.fromCallable(() -> "Do Something")
.subscribeOn(Schedulers.io())
.subscribe(System.out::println);
If I want to watch in the main thread and do in the background in Android I would do ...
Observable.fromCallable(() -> "Do Something")
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(System.out::println);
But If I were writing a standard Java program, what is the equivalent of the state you want to observe on the main thread?
+10
source to share