openmrs-client/src/main/java/org/openmrs/mobile/activities/addeditpatient/AddEditPatientActivity.java
/**
     * The method creates a warning dialog when the user presses back button while registering a patient
     */
The method creates a warning dialog when the user presses back button while registering a patient
The method creates a warning dialog when the user presses back button while registering a patient
private void showInfoLostDialog() {
        AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
                this,R.style.AlertDialogTheme);
        alertDialogBuilder.setTitle(R.string.dialog_title_reset_patient);
        alertDialogBuilder
            .setMessage(R.string.dialog_message_data_lost)
            .setCancelable(false)
            .setPositiveButton(R.string.dialog_button_stay, (dialog, id) -> dialog.cancel())
            .setNegativeButton(R.string.dialog_button_leave, (dialog, id) -> {
                super.onBackPressed();
                finish();
            });
        alertDialog = alertDialogBuilder.create();
        alertDialog.show();
    }
private void showInfoLostDialog ( ) { AlertDialog . Builder alertDialogBuilder = new AlertDialog . Builder ( this , R . style . AlertDialogTheme ) ; alertDialogBuilder . setTitle ( R . string . dialog_title_reset_patient ) ; alertDialogBuilder . setMessage ( R . string . dialog_message_data_lost ) . setCancelable ( false ) . setPositiveButton ( R . string . dialog_button_stay , ( dialog , id ) -> dialog . cancel ( ) ) . setNegativeButton ( R . string . dialog_button_leave , ( dialog , id ) -> { super . onBackPressed ( ) ; finish ( ) ; } ) ; alertDialog = alertDialogBuilder . create ( ) ; alertDialog . show ( ) ; }
The method creates a warning dialog when the user presses back button while registering a patient
The method creates a warning dialog when the user presses back button while registering a patient
// set dialog message // Finish the activity