如何得到通知时,在Android的活动/任务的变化 [英] How to be notified when activity/task changes in Android
问题描述
我建立一个系统状态记录器。我想,当任何活动/任务被带到堆栈停止收到通知,并且由用户(不只是我写的一个)变得可见。
I'm building a system status logger. I'd like to be notified when any activity/task is brought to the stop of the stack and becomes visible by the user (not just the one I wrote).
ActivityManager能够制定出什么在上面: <一href="http://developer.android.com/reference/android/app/ActivityManager.html">http://developer.android.com/reference/android/app/ActivityManager.html
ActivityManager makes it possible to work out what's on top: http://developer.android.com/reference/android/app/ActivityManager.html
不过,这需要我经常民意调查,以重新计算什么在上面浪费了大量的资源。有没有一种方法来接收事件/回调/通知,当一个活动的变化?
however, this requires that I frequently poll to recalculate what's on top wasting a lot of resources. Is there a way to receive an event/callback/notification when an activity changes?
**编辑**要清楚 - 我要当的任意的活动成为活动的活动通知
** edit ** To be clear -- I want to be notified when any activity becomes the active activity.
推荐答案
onResume()活动时谈到生活状态叫。
onResume() is called when activity comes to live state.
这篇关于如何得到通知时,在Android的活动/任务的变化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!