mcfly
mcfly
Sep 5, 2018 · 1 min read

There is just one mistake in your demonstration.
You should set the subscribeOn and ObserveOn here :
observable.subscribe(observer);
To this :
searchObs
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(res -> Log.d(“AddFriendPresenterS”, “ thread:” + Thread.currentThread().getName() ));

As you do it, the hot observable is doing his job in main thread instead of doing it in another thread.

    mcfly

    Written by

    mcfly

    Currently co-creating my own dev agency dedicated to mobile applications.