title: How does on"XYZ" callback event work?
body: <p>I'm looking for concept explanations or example code, if possible</p>
  
  <p>I'm new to (android) development and from what i've seen, there are a ton of "onEvent()" methods. for example, View.onClickListener(), onPageDownload, onProgressUpdate... i've noticed that everything starts with "on", and i'm assuming that it implies the method is a callback event? is that the same thing as a handler?</p>
  
  <p>i have a hard time understanding how events work, and what's the best way to make my own event handler. </p>
  
  <p>say i want to make a handler <code>onImageDownloaded()</code> that gets called when a certain event happens. like perhaps i'm downloading an image, and i want to trigger an event when the image downloads (and yes, i get that there is something called <code>AsyncTask</code> and also posting a runnable message from background thread, but for pedagogical reasons let's pretend the process could have been on the UI thread also). How does Android know to call the method <code>onImageDownloaded()</code> ? or rather, how do i specify that when an image gets downloaded, i want it to call my method <code>onImageDownloaded()</code> ?</p>
  
  <p>i've read about broadcast intents, but that seems more of a system level and kind of over-doing it. </p>
  
  <p>I know that when you make a button in the view, you can do</p>
  
  <pre><code>final Button b = (Button) findViewById(R.id.mybutton);
  b.setOnClickListener(new View.OnClickListener() {
      @Override
      public void onClick(View v) {
          Log.d("MyActivity", "button is clicked");
      }
  });
  </code></pre>
  
  <p>and it's almost like setting a "hook" to the button that calls the particular "onClick" when the click event happens. </p>
  
  <p>in my particular case, how would i create a custom callback method upon actions "XYZ" ??</p>
  
  <p>sorry for the long question, thanks for the patience to read and to try and understand it</p>