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 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() is called when activity comes to live state.