我在从服务器调用填充的 fragment 上有一个 ArrayList,如果我导航到其他 fragment 并在某些设备上返回此 fragment 后检查集合大小,则列表为空,而在某些设备上则不是。
当 fragment 进入返回堆栈时究竟发生了什么?
最佳答案
Stopped
The fragment is not visible. Either the host activity has been stopped or the fragment has been removed from the activity but added to the back stack. A stopped fragment is still alive (all state and member information is retained by the system). However, it is no longer visible to the user and will be killed if the activity is killed.
一旦停止,它们就有资格被销毁。
关于android - fragment 有时会在返回堆栈时保存变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38235693/