gpt4 book ai didi

Android: onCreate before OnDestroy between Activity

转载 作者:行者123 更新时间:2023-11-30 04:12:27 24 4
gpt4 key购买 nike

我有 2 个 Activity,Activity1 的结束调用 Activity2 的开始。在 Activty1 的 onDestroy() 中,我做了一些对 Activity2 很重要的事情。不好的是 Activity2 的 onCreate() 在 onDestroy 之前被调用。我能做什么?

谢谢娜塔

最佳答案

onPause() 而不是 onDestroy() 中执行您需要的操作。您无法控制 onDestroy() 何时发生,这完全取决于系统。即使您调用 finish(),您的 Activity 也可能会一直挂起,直到系统需要资源。

关于Android: onCreate before OnDestroy between Activity,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10628505/

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