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