Android RX - Observable.timer 只點燃一次
2022-09-01 05:45:12
因此,我试图创建一个定期触发的可观察量,但由于某种我无法弄清楚的原因,它只触发一次。有人能看到我做错了什么吗?
Observable<Long> observable = Observable.timer(delay, TimeUnit.SECONDS, Schedulers.io());
subscription = observable
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Action1<Long>() {
@Override
public void call(Long aLong) {
searchByStockHelper.requestRemoteSearchByStock();
}
});
当前延迟设置为 2