title: Android custom class - Hook into Activity Lifecycle
body: <p>I have an activity in which I want to monitor battery life.  I want to decouple the battery life into it's own class.  I could do the following in the activity</p>
  
  <pre><code>onPause() {
    batteryChecker = new BatteryChecker();
  }
  onResume() {
     batteryChecker.kill();
  }
  </code></pre>
  
  <p>I would prefer to just do this:</p>
  
  <pre><code>onCreate() {
    bg = new BatteryChecker(this);
  }
  </code></pre>
  
  <p>Is there any way I can get BatteryChecker to respond to the onPause/onResume of the attached activity?  </p>