NetworkOnMainThreadException using OkHttp with RxJava2

后端 未结 2 1772
情话喂你
情话喂你 2021-01-29 08:28

I am trying to learn Rxjava2. I am facing a problem i.e, NetworkOnMainThreadException during network call using okHttp. I have to use only okHttp libary.

This is my meth

2条回答
  •  醉梦人生
    2021-01-29 09:11

    You're calling service.getData(httpParamObject) in the main thread and passing that result to Observable.just. So your subscribeOn has no effect.

    Check the documentation of Observable.create and use it instead of Observable.just

提交回复
热议问题