通过该文档,在以下情况下调用“onPause”:
when the system is about to start resuming a previous activity.
与“onStop”相比,不同之处在于:
Called when the activity is no longer visible to the user, because another activity has been resumed and is covering this one.
但是,当我长按HW-Home键并显示“最近的应用程序”时,
“onPause”未被调用.
此刻,我无法与原始活动进行互动,
但它仍然可见.
我很困惑这种情况.
请帮忙解释一下.
非常感谢你.
BR,
亨利
解决方法:
这实际上是因为长按Home键时,没有启动任何活动.仅当您选择“最近应用”列表中存在的某个应用时,才会调用onPause / onStop.
onPause()的文档很清楚:
Called as part of the activity lifecycle when an activity is going
into the background, but has not (yet) been killed.
标签:onpause,android,timing,android-activity,lifecycle
来源: https://codeday.me/bug/20191008/1870665.html