https://kotlinlang.org logo
#feed
Title
# feed
e

elizarov

05/10/2017, 12:09 PM
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

marcinmoskala

05/10/2017, 12:46 PM
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

elizarov

05/10/2017, 12:54 PM
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

marcinmoskala

05/10/2017, 5:26 PM
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.
3 Views