I'm learning RxJava and I have some doubts regarding the Scheduler
.
When to use which one. The AndroidSchedulers.mainThread()
is quite easy and clear,
whenever we need to come to the Android UI thread, we can use this scheduler.
But I'm confused with the other Schedulers
Schedulers.io()
Schedulers.computation()
Schedulers.newThread()
In many samples I have seen pepople using Schedulers.io()
and Schedulers.computation()
for network calls ,
db operations etc. Can we pick any of them randomly for background tasks?
If not which are the suitable situations to pick each? When to use Schedulers.newThread()
?
It would be helpful if someone could explain it in simple words. Thanks in advance!!