简体   繁体   English

如何从非启动器 android 活动中查找 HOME 键按下暂停原因

[英]How to find HOME key press pause reason from a non-launcher android activity

When HOME button is pressed activity goes pause state but if the activity is NOT a launcher or MAIN activity then I want to find actual reason why the top activity goes pause state.当按下 HOME 按钮时,活动暂停 state 但如果该活动不是启动器或主要活动,那么我想找到顶级活动暂停 state 的实际原因。

Would someone suggest how I can get pause reason from a non-launcher/ non-home activity which is on top before goes to pause due to HOME button press action?有人会建议我如何从顶部的非启动器/非家庭活动中获取暂停原因,然后由于 HOME 按钮按下操作而暂停?

That's ecpected behavior.这是预期的行为。 The HOME button brings up the launcher app. HOME 按钮调出启动器应用程序。 That means the launcher app's activity is now the foreground activity.这意味着启动器应用程序的活动现在是前台活动。 There is only one foreground activity in Android at a time. Android 中一次只有一个前台活动。 That means whatever was previously the foreground activity will be paused, then stopped (unless for some reason part of it remains on screen, which would be weird but possible with a 3rd party launcher I suppose).这意味着以前的前台活动将被暂停,然后停止(除非出于某种原因,它的一部分仍保留在屏幕上,这很奇怪,但我想使用 3rd 方启动器是可能的)。

Why don't you think it should be paused?你为什么不认为它应该暂停? I think you don't understand how activity lifecycles work.我认为您不了解活动生命周期的工作原理。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM