title: Android event listener for app lifecycle
body: <p>I am writing an Android code segment to help tracing Android event as a service tool for app developers.</p>
  
  <p>For example, the main app body can be just to display 'hello world'. My code will listen to the app event, such as <code>onStart()</code>, <code>onResume()</code>, <code>onDestroy()</code>, etc, and keep a trace on these events. </p>
  
  <p>Certainly, the code can be inserted directly under the main activity. But that means my code will be allover the places. Is there a way, I can create an object (i.e., a listener), and only request the app developer to add 1~2 liner to use my code?</p>