I am developing an application that when the button is pressed, it opens a dialog with OK and Cancel buttons.
It works fine.
When the user presses the back b
Try this
new AlertDialog.Builder(this).setOnKeyListener(new DialogInterface.OnKeyListener() {
@Override
public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
if(keyCode == KeyEvent.KEYCODE_BACK){
Logger.d(TAG, "--------- Do Something -----------");
return true;
}
return false;
}
})