title: in saveState what's my context?
body: <p>I am trying to do some cleanup within a saveState() call.  I want to pop-up a dialog if there is
  an error on exiting the activity, but the activity is already gone by this point.</p>
  
  <p>I want to have this happen from an activity called StudentEdit but what should the context be?
  When I use StudentEdit.this, the dialog pops up and then disappears.  getApplicationContext causes
  a null pointer exception.</p>
  
  <pre><code>private void saveState() {
  
      // some error checking code
      // if blah blah
      AlertDialog alertDialog = new AlertDialog.Builder(StudentEdit.this).create();
  
  alertDialog.setMessage("error");
  
  alertDialog.setButton(BUTTON_POSITIVE, "Yes", new DialogInterface.OnClickListener() {
      public void onClick(DialogInterface dialog, int which) {
  
                 // do something for yes
  
                } });
  alertDialog.setButton(BUTTON_NEGATIVE, "No", new DialogInterface.OnClickListener() {
      public void onClick(DialogInterface dialog, int id) {
               dialog.cancel();            // kill dialog
               StudentEdit.this.finish();  // kill the activity
      }
  });
  alertDialog.show();
  
  } 
  </code></pre>