I am trying to create a completable and run it on background thread but it's not calling Action
's run()
when I am subscribing on Schedulers.io()
Basically I want to do following through RxAndroid:
Thread t = new Thread(new Runnable() {
public void run() {
doSomething();
}
});
t.start();
Using RxAndroid I am doing following:
Completable.fromAction(new Action() {
@Override
public void run() throws Exception {
doSomething();
}
}).subscribeOn(Schedulers.io());
It's run()
method is not getting called if I do Schedulers.io()
, but it gets called if I do subscribe()
.
I am unable to find why it's running when I subscribe for Schedulers.io()
.