My question can be a duplicate of How to use CompositeDisposable of RxJava 2? But asking to clear one more doubt. According to the accepted answer
// Using
You're right, you can save yourself from creating a new CompositeDisposable
for each time the corresponding view is created, but instead treat a CompositeDisposable
as a single instance tied to the onCreate/onDestroy
lifecycle methods and treat aggregated disposables as part of the fragment view calling clear
in onDestroyView
.