6

Possible Duplicate:
Android Activity Life Cycle - difference between onPause() and OnStop()

my question is about if it is possible to detect when an Android activity starts/ends.

The idea would be to have a listener o callback method to execute some code during those events, but I can't find anyone :_(

Thank you very much in advance for your help!!!

Community
  • 1
  • 1
pedromateo
  • 2,535
  • 1
  • 16
  • 19

1 Answers1

1

Checkout the android activity life cycle. You have hooks available to do custom tasks during the various life cycle events.

Kalarani
  • 407
  • 4
  • 10
  • 1
    thanks!! but I would like to do it externally. I mean, from a separate --control-- class in which I can control when an activity starts or ends – pedromateo Jun 09 '11 at 09:09
  • Why would you want to do that? There are probably more standard ways of achieving what you want to do, which would be more likely to get further help on. – CL22 Jun 09 '11 at 09:10
  • 1
    I am creating instrumentation classes, so I need to track what is happening inside the application, but not using class intrusiveness (e.g. add code into an activity is not allowed, I have to control this activity from outside) – pedromateo Jun 09 '11 at 09:17