Is it recommended to call Disposable.dispose() as soon as a subscription completes work?

前端 未结 2 966
孤城傲影
孤城傲影 2021-01-01 22:54

I have an Activity in which I\'m creating and subscribing to multiple instances of the Single class (each doing some work in a separate background

2条回答
  •  孤街浪徒
    2021-01-01 23:17

    No, you shouldn't.When an Observable is completed, Observable is disposed of by itself.
    This is part of the Observable contract:

    When an Observable issues an OnError or OnComplete notification to its observers, this ends the subscription. Observers do not need to issue an Unsubscribe notification to end the subscriptions that are ended by the Observable in this way.

提交回复
热议问题