Is it mandatory to remove yourself as an observer from Android Lifecycle?

后端 未结 3 588
渐次进展
渐次进展 2021-01-01 11:10

I am building an Android Java class which implements the LifecycleObserver interface.

This is the constructor:

public MyObserver(AppCompatActivity a         


        
3条回答
  •  北荒
    北荒 (楼主)
    2021-01-01 11:48

    TL;DR: Nope.

    According to this link here, where a user asked your question on the android-lifecycles Github repo. The answer of a Google developer to this questions was:

    Yes, that's the whole point of the new lifecycle-aware components, no need to unsubscribe/remove observers.

提交回复
热议问题