我要检查,看是否活动正在运行或完成。有没有通过它我可以检查活动的状态,任何方法?
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.
更多推荐
如何知道活动已经完成?
发布评论