本人小白,没学过kotlin,然而项目是用kotlin写的,在用retrofit+rxjava时,直接使用java转kotlin,然而遇到了问题
//2、用retrofit加工出对应的接口实例对象
ApiService api = retrofit.create(ApiService.class);
//3、获取数据并更新UI--再也不需要使用handler或者runOnUiThread了
api.getKnowledgeSystem(1, 60)
.compose(RxSchedulers.<KnowledgeSystem>io_main())
.subscribe(new Consumer<KnowledgeSystem>() {
@Override
public void accept(KnowledgeSystem knowledgeSystem) throws Exception {
Log.e(TAG, "KnowledgeSystem--" + knowledgeSystem.toString());
mTvHello.setText(knowledgeSystem.toString());
}
}, new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
Log.e(TAG, "Throwable--" + throwable.toString());
}
});
其中的.subscribe()出了问题,里面到底该如何转成kotlin?