如何知道活动已经完成?

编程入门 行业动态 更新时间:2024-10-28 08:21:27
本文介绍了如何知道活动已经完成?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我要检查,看是否活动正在运行或完成。有没有通过它我可以检查活动的状态,任何方法?

I want to check to see if an activity is running or finished. Is there any method through which I can check the status of activity?

我发现 activity.isFinishing(),但我不知道这件事。

I found activity.isFinishing() but I am not sure about it.

推荐答案

如果您要执行活动之前的任何步骤将变得不可见。

If you want to perform any step before Activity is going to become invisible.

他们在这里有多种选择。

Their are several choices here.

onDestroy() - 进行最后的清理

onDestroy() - for final cleanup.

isFinishing() - 右后 act.finish()被称为它将返回true

isFinishing() - right after act.finish() is called it will return true.

的onStop() - 对活动被杀害框架进程。 (不破坏)

onStop() - when the Activity is killed by framework process. (not destroyed)

的onPause() - 对活动覆盖任何其他活动

onPause() - when the Activity is covered by any other Activity

onBack$p$pssed() - 捕获硬件返回键由用户触发的事件

onBackPressed() - capturing the event of hardware Back key triggered by user.

更多推荐

如何知道活动已经完成?

本文发布于:2023-08-02 13:25:03,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1278162.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!