Android – rxjava observeon and subscribeon in Retrofit

Observeon: this method only changes the threads of all downstream operators( https://medium.com/upday-devs/rxjava-subscribeon-vs-observeon-9af518ded53a )

When calling the API, I want to run communication with the server on the IO thread and want to process the results on the mainthread

I have seen the following code in many tutorials. There is no doubt that it is correct. But my understanding is the opposite, so I want to know what I misunderstood

requestInterface.callApi()
    .observeOn(AndroidSchedulers.mainThread())
    .subscribeOn(Schedulers.io())
    .subscribe())
@H_502_14@

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>