Firstly in your dialog class pass the context of the caller activities say MainActivit.class context
Now first close the dialog
//so as to avoid the window leaks as on destroying the activity it's context would also get vanished.
dialog.dismiss();
and then
((Activity) context).finish();