title: Finish activity in dialog class
body: <p>In my <code>MainActivity</code> I call</p>
  <pre><code> MyDialog dialog = new MyDialog(MainActivity.this);
   dialog.show();
  </code></pre>
  <p><code>MyDialog</code> is my own class where I customize the dialog.
  In the dialog is a button. I want that the <code>MainActivity</code> and the dialog finishes/dissappears when the button is pressed, because I start another Activity then.
  How can I say in the <code>MyDialog</code> class, in the <code>onClickListener</code>, that the <code>MainActivity</code> should <code>finish()</code>?</p>
  <p>Shortened code of my dialog:</p>
  <pre><code>public class MyDialog extends Dialog implements OnClickListener {
  
      void onClick() {
          Intent menu = new Intent(getContext(), Menu.class);
          getContext().startActivity(menu);
      }
  }
  </code></pre>