tags:

views:

53

answers:

2

Is it possible to determine the moment of switching of certain Activity from foreground to background and vice versa? This activity should run in the separate process.

I need to write the application that collects some statistics from using of big set of applications (app names read from configuration file). My application works as Service and should remember moments of switching of activities between foreground and background. Set of applications is sufficiently big and most part of these applications will never work on certain phone.

A: 

I don't know a lot about that but I think you could try to do some digging in that direction : onFocusChangeListener by applying it to the whole activity (refered as "this" in your onCreate for instance)

Sephy
A: 

What about tracking intents? If you play around on a phone or emulator while looking at LogCat, you'll see that every time an activity is started or accessed there's a log message about the intent that was broadcast. I'm not sure how your program could intercept and process these, but it's another place to start looking.

Steve H