Observable.create(new ObservableOnSubscribe<String>() {
@Override
public void subscribe(ObservableEmitter<String> e) throws Exception {
while (!Thread.currentThread().isInterrupted()) {
//TODO
}
}
})
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(observer);
所以我有这段代码。我想在执行onResume()方法时开始发出值,并在执行onPause()方法时停止它。我怎么能这样做?
提前致谢!