<http://marcinmoskala.com/android/kotlin/2017/05/0...
# feed
e
marcinmoskala: Thanks for great article. A few questions, though. In your
LoginPresenter
code you keep adding subscription to a
subscriptions
list on each login attempt. While this might not be an issue here, how do you write the corresponding code for a longer-running activity?
m
This
subscriptions
is just to dispose them in case of Activity destroy. In standard project I have abstract Presenter and PresenterBaseActivity that are doing this clean-up for me. Like in here: https://github.com/MarcinMoskala/SimpleKotlinMvpBoilerplate
But I am not sure if this is what you asked for?
e
I see that you dispose all of them onDestroy. But what about long-running activity (does not get destroyed for quite a while). On each async action you are just adding more and more subscriptions to the list. Isn’t it causing problems?
m
I never really though about it because it is pretty standard way to deal with this this. Or by CompositeDisposable from RxJava lib which is actually doing the same https://github.com/ReactiveX/RxJava/blob/2.x/src/main/java/io/reactivex/disposables/CompositeDisposable.java But I am pretty sure that this subscriptions, especially finished, are not big enough to use all phone memory. If they do then I think that we can do nothing with that.