Understanding Fragment's setRetainInstance(boolean)

后端 未结 5 692
太阳男子
太阳男子 2020-11-22 04:46

Starting with the documentation:

public void setRetainInstance (boolean retain)

Control whether a fragment instance is retained across Activity re

5条回答
  •  鱼传尺愫
    2020-11-22 05:35

    setRetainInstance(boolean) is useful when you want to have some component which is not tied to Activity lifecycle. This technique is used for example by rxloader to "handle Android's activity lifecyle for rxjava's Observable" (which I've found here).

提交回复
热议问题