I'm using ViewModel from Android Architecture Components in my app. In the ViewModel, I'm using RxJava2 subscription and I keep Disposable object after I subscribe. Before, when I did this in Activity, I was used to dispose the Disposable in onDestroy() - to avoid memory leaks:
@Override
protected void onDestroy() {
disposable.dispose();
super.onDestroy();
}
When and how should I dispose it in ViewModel? Do I actually need to do that?