Answer the question
In order to leave comments, you need to log in
How to execute intents asynchronously in RxJava?
This is my first time using rxjava and after reading about
subscribeOn(Schedulers.newThread())
observeOn(Schedulers.newThread())
I was hoping I could do something like this:
Subject<DataObservable> commandToService.subscribeOn(Schedulers.newThread()).observeOn(Schedulers.newThread()).subscribe(observer);
//слушатель
private Observer<DataObservable> observer = new Observer<DataObservable>() {
@Override
public void onNext(DataObservable o) {
//какая-то долгая операция
}
};
private void postCommand(DataObservable command){
commandToService.onNext(command);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question