title: How to define custom events and event listeners in Android?
body: <p>I'm a starter in Android app development, and my experience in Java development is also minimal. </p>
  
  <p>I'm working on a very basic context-aware application and I want to understand how can I notify my activity class of some custom event? (unlike onClick()). So if I have a class which is responsible for monitoring some resource. (For simplicity, let's assume a Timer  class which monitors time and notifies the Activity class every hour). </p>
  
  <p>How can my activity class 'subscribe' and listen for such events from the Timer class? </p>
  
  <p>I would really appreciate if you provide some code example and perhaps how event handling works in Android/Java. Thanks for your time and help!</p>