Managing Disposables in RxJava 2 — For Android
Cody Engel
2097

I wouldn’t recommend having static CompositeDisposable instance. 
Lets say when you leave an activity A to go on next one B, that’s the lifecycle.

  • onPause() Activity A
  • onCreate() Activity B
  • onStop() Activity A
  • onDestory() Activity A

If I am adding a disposable to DisposableManager, there are good chances I won’t get the result, subscribed methods won’t be called. What I subscribed in onCreate() of Activity B will be disposed on onDestory() of Activity A.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.