Why you have to dispose a thing on CompositeDisposable in RxJava?

242 Views Asked by At

Sorry i am still newbie in android development. I wanted to understand why we have to dispose thing from CompositeDisposable? and why we have to use CompositeDisposable?

1

There are 1 best solutions below

0
NIKHIL AGGARWAL On BEST ANSWER

We have to dispose disposables from CompositeDisposable to stop the in progress requests when they are not required anymore. They should be cleared every time a user navigates to another activity from current activity or in cases in which the current activity is destroyed to cancel pending disposable requests and avoid memory leaks.