title: Toast object crashing app
body: <p>I have this MainActivity that crashes my application instantly. Why is this happening? I tried to substitute the "MainActivity.this" part of the argument with an object of type Context: <code>Context aContext = getApplicationContext();</code>, following Google's reference example, with the exact same result.</p>
  
  <p>What am I doing wrong? </p>
  
  <p>Thanks much. </p>
  
  <pre><code>package com.nactus.questionme;
  
  import android.app.Activity;
  import android.content.Context;
  import android.os.Bundle;
  import android.view.View;
  import android.widget.Button;
  import android.widget.Toast;
  
  public class MainActivity extends Activity {
  
      private Button mMadridButton;
      private Button mWrongButton;
      private Toast aToast;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          // target the buttons
          mMadridButton = (Button) findViewById(R.string.button_madrid);
          mWrongButton = (Button) findViewById(R.string.button_wrong);
  
          // set event listeners
          mMadridButton.setOnClickListener(new View.OnClickListener() {
  
              @Override
              public void onClick(View v) {
  
                  Context context = getApplicationContext();
  
                  // my code goes here
                  aToast = Toast.makeText(context, "test", Toast.LENGTH_SHORT);
  
                  aToast.show();
              }
          });
  
          mWrongButton.setOnClickListener(new View.OnClickListener() {
  
              @Override
              public void onClick(View v) {
  
                  Context context = getApplicationContext();
  
                  // my code goes here
                  aToast = Toast.makeText(context, "test", Toast.LENGTH_SHORT);
  
                  aToast.show();
              }
          });
      }
  
  
  
  }
  </code></pre>
  
  <p>Code updated to reflect suggestions: same crash</p>