When the screen orientation changes, the Observable is not deleted, but continues to exist in its stream. How can I solve this problem?

rx.Observable.create((Subscriber<? super InitResualt> subscriber)->{ //опрос сервера }) .retry() .subscribeOn(Schedulers.newThread()) .observeOn(AndroidSchedulers.mainThread()) .subscribe((t)->{ Log.d(GV.LOG_TITLE,"Next"); },(t)->{ Log.d(GV.LOG_TITLE,"Error"); },()->{ this.showMessege("bla bla bla"); }); 

    1 answer 1

    You can solve it in two ways, allow it to live and re-subscribe using any solution, for example this one , or nail it to unsubscribe() onStop or onPause

    • And if in Observable files are being downloaded in a loop (or other long-running operation)? Ie after unsubscribe Observable continues to perform actions? - Vadimcg
    • if you use pure rx without wrappers, like the one that follows the link, then when you call unsubscribe, the idea should stop the execution :) - andreich
    • no, continues to be performed - Vadimcg
    • there are two options here: either it was written correctly, or the stream is blocked by something, and it cannot stop :) - andreich