[英]FragmentActivity calls onCreate after coming back from another Activity
So, I need some code to be executed only once when FragmentActivity
is created. 因此,我需要一些代码在创建
FragmentActivity
时仅执行一次。 I was method thining that protected void onCreate(Bundle savedInstanceState)
is only called first time when FragmentActivity comes to flow. 我的方法
protected void onCreate(Bundle savedInstanceState)
,只有在FragmentActivity出现时才第一次调用protected void onCreate(Bundle savedInstanceState)
。 But, then from that FragmentActivity I go into another and after coming back from that second one, onCreate
gets called again. 但是,然后从那个FragmentActivity进入另一个,然后从第二个回来,再次调用
onCreate
。 I was looking on FragmentActivity cycle and that's not clear for me. 我一直在寻找FragmentActivity周期,但这对我来说还不清楚。 Is there method that only gets invoked at very beginning and not after coming back on that activity any more?
是否存在仅在一开始就被调用而又不在该活动之后被调用的方法?
Could you verify that FragmentActivity.onDestroy
is not called? 您可以验证是否未调用
FragmentActivity.onDestroy
吗? If it does get called, maybe the second paragraph of the of the Activity lifecycle could help you understand what's going on. 如果确实被调用, 那么活动生命周期的第二段也许可以帮助您了解发生了什么。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.