title: Why doesn't the 'toast' message work, in Android? Cannot fix bug, please help!
body: <p>Imagine I have the following code that runs as a background processor for an android application:</p>
  
  <pre><code>public class Background extends Service 
  {
      public void popup (String message, int duration)
      {
          Toast.makeText(this, message, duration).show();
      }
  
      class BackgroundChecker extends TimerTask 
      {
          public void run()
          {
              popup("Message!", Toast.LENGTH_LONG); // here
          }
      }
  }
  </code></pre>
  
  <p>When it reaches the popup message i.e. // here, Android tells me to force quit. I know that the problem is with context i.e. <code>this</code>, but I don't know why because I have extended Service in that class which Android API told me to. Can you help me figure out why this is happening and how to fix it? By the way, instead of <code>this</code> I used <code>getApplicationContext()</code> as well but it still crashes =(.</p>
  
  <p>Thank you.</p>