gpt4 book ai didi

android - fragment 有时会在返回堆栈时保存变量

转载 作者:行者123 更新时间:2023-11-30 01:13:03 25 4
gpt4 key购买 nike

我在从服务器调用填充的 fragment 上有一个 ArrayList,如果我导航到其他 fragment 并在某些设备上返回此 fragment 后检查集合大小,则列表为空,而在某些设备上则不是。

当 fragment 进入返回堆栈时究竟发生了什么?

最佳答案

根据 documentation

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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com