0

public void showEditPassword() {

    LayoutInflater li = LayoutInflater.from(this);
    View promptsView = li.inflate(R.layout.dialog_editpassword, null);

    AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);

    // set prompts.xml to alertdialog builder
    alertDialogBuilder.setView(promptsView);

    final EditText txtOldPass, txtNewPass, txtConfirmPass;

    txtOldPass = (EditText) promptsView.findViewById(R.id.txtOldPassword);
    txtNewPass = (EditText) promptsView.findViewById(R.id.txtNewPassword);
    txtConfirmPass = (EditText) promptsView.findViewById(R.id.txtConfirmPassword);


    // set and show dialog edit password
    alertDialogBuilder.setCancelable(false)
            .setPositiveButton("SAVE",
                    new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog,int id) {
                            //do the saving here

                            saveNewPassword(currentPassword, txtOldPass.getText().toString(),
                                    txtNewPass.getText().toString(), txtConfirmPass.getText().toString());
                            //recreate();
                            Toast.makeText(MainActivity.this, "Save Password clicked", Toast.LENGTH_LONG);

                        }
                    })
            .setNegativeButton("CANCEL",
                    new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog,int id) {
                            dialog.cancel();
                        }
                    });

    // create alert dialog
    AlertDialog alertDialog = alertDialogBuilder.create();

    // show it
    alertDialog.show();
}

I want to call a input dialog and capture the save button action when click. I have tried putting a Toast message when save button was clicked in the dialog but nothing' happened. Thanks.

Henry
  • 42,982
  • 7
  • 68
  • 84

1 Answers1

0

You do not call show() on your Toast. That's why it looks like nothing is happening

0xDEADC0DE
  • 2,453
  • 1
  • 17
  • 22