新活动在onStart是父母的onStop之前调用 [英] onStart of new Activity is called before onStop of parent
问题描述
我有一个应用程序。我使用 startActivity()
开始活动。
I've got an application. I use startActivity()
to start activity.
谁能居然告诉我为什么系统调用在onStart()
新活动的第一个,而不是父母的onStop()
?是,甚至有可能(没有系统漏洞)?
Can anyone actually tell me why system is calling onStart()
of new Activity first, instead of parents onStop()
? Is that even possible (without system bug)?
我发现<一个href=\"http://stackoverflow.com/questions/7581986/fragment-onstop-being-called-directly-after-onstart-why\">Fragment的onStop()被调用onStart后直接调用() - 为什么回答,但我共同啥都没带片段,并使用Android的支持库。我坚持是因为我使用RoboSpice,它必须包含在onStart和适当的onStop,同步方法。我不能,因为系统调用它在错误的顺序。
I've found Fragment onStop() being called directly after onStart() - WHY? answer, but I got nothing in common with Fragments and using android-support library. I'm stuck because I'm using RoboSpice and it must contain proper, synchronized methods in onStart and onStop. I can't because system is calling it in wrong order.
我使用GCM和分析库,以及在此应用程序。
I'm using GCM and Analytics libraries as well in this application.
推荐答案
如果您拥有的 的onStop活动生命周期的文档时,当前的活动是由一个新的(或previous)代替只调用一次。
If you have a read of the Activity Lifecycle documentation onStop is only called when the current activity is replaced by a new (or previous) one.
有关这样的事情发生在其他应用程序已启动或恢复......否则就不会有差距
For that to happen the other application has to start or resume... otherwise there would be a gap
当前活动的onPause是(我希望)被称为替代活动的前调用onStart
onPause of the current activity is (I would expect) called before the onStart of the replacing Activity
这篇关于新活动在onStart是父母的onStop之前调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!