RXjava 线程调度问题 对比了源码 直接复制过来也会报错

来源:7-8 同意添加好友消息

旅途ing

2021-10-27

RXjava 线程调度问题

报错
RxJava:io.reactivex.exceptions.OnErrorNotImplementedException: The exception was not handled due to missing onError handler in the subscribe() method call. Further reading: https://github.com/ReactiveX/RxJava/wiki/Error-Handling | org.litepal.exceptions.DatabaseGenerateException: can not find a class named com.test.model.Reader

disposable = Observable.create(new ObservableOnSubscribe<List>() {
@Override
public void subscribe(@NonNull ObservableEmitter<List> emitter) throws Exception {
emitter.onNext(LitePalHelper.getInstance().queryNewFriend());
emitter.onComplete();
}
}).subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<List>() {
@Override
public void accept(List newFriends) throws Exception {
if (!StringUtils.isEmpty(newFriends)) {
mList.addAll(newFriends);
mNewFriendAdapter.notifyDataSetChanged();
}else {
showViewStub();
mNewFriendView.setVisibility(View.GONE);
}
}
});

写回答

1回答

刘某人

2021-11-19

在Application中有个捕获全局异常的方法,也要添加下

0
0

聚焦市场开发热门技术 手把手带你开发商业级社交App

从零打造一款跟随灵魂的高性能社交App

559 学习 · 194 问题

查看课程