如果当前从Home键点击退出去的Activity为singleInstance模式 当长按home键进去的时候,走的是onRestart()-onStart()-onResume()的生命周期 而点击图标走的是onNewIntent()-onRestart()-onStart()-onResume()-... 对于onNewIntent使用场合,看API这句: This is called for activities that set launchMode to "singleTop" in their package, or if a client used the {@link Intent#FLAG_ACTIVITY_SINGLE_TOP} flag when calling {@link #startActivity}. In either case, when the activity is re-launched while at the top of the activity stack instead of a new instance of the activity being started, onNewIntent() will be called on the existing instance with the Intent that was used to re-launch it.
当长按home键进去的时候,走的是onRestart()-onStart()-onResume()的生命周期
而点击图标走的是onNewIntent()-onRestart()-onStart()-onResume()-...
对于onNewIntent使用场合,看API这句:
This is called for activities that set launchMode to "singleTop" in
their package, or if a client used the {@link Intent#FLAG_ACTIVITY_SINGLE_TOP}
flag when calling {@link #startActivity}. In either case, when the
activity is re-launched while at the top of the activity stack instead
of a new instance of the activity being started, onNewIntent() will be
called on the existing instance with the Intent that was used to
re-launch it.