I am working with a dialog, and two negativeButton and positiveButton. Nevertheless, I would like to change the behaviour when pressing outside the box. I have checked, and all the questions I have found about this topic are about hiding the AlertDialog when clicking outside dialog.dimiss(), but this is not my question. I want to know if there is a listener which allows me to switch this behaviour (would like to call other methods and remove other variables).
JAVA
    AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(m_activity);
    alertDialogBuilder.setTitle("Navigation");
    alertDialogBuilder.setMessage("Choose Mode");
    alertDialogBuilder.setNegativeButton("Navigation", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialoginterface, int i) {
            m_navigationManager.startNavigation(m_route);
            m_map.setTilt(60);
            startForegroundService();
        }
        ;
    });
    alertDialogBuilder.setPositiveButton("Simulation", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialoginterface, int i) {
            m_activity.findViewById(R.id.address_form).setVisibility(View.INVISIBLE);
            m_navigationManager.simulate(m_route, 30);//Simualtion speed is set to 45 m/s
            m_map.setTilt(60);
            startForegroundService();
        }
    });
    AlertDialog alertDialog = alertDialogBuilder.create();
    alertDialog.show();