I show the start activity dialog with:
mDialog.setCanceledOnTouchOutside(false);
When the user clicks the back button, first rejects the dialog box and then clicks the back button again to close the action. I want to do this with one click, close the dialog and close the activity. I also tried using the following code:
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { // TODO Auto-generated method stub if (keyCode == KeyEvent.KEYCODE_BACK) { // AppDialogUtils.mDialog.setCancelable(true); // AppDialogUtils.mDialog.dismiss(); mActivity.finish(); } return super.onKeyDown(keyCode, event); }
source share