Question

I'm opening an alert dialog from an activity using the 'onCreateDialog' method:

protected Dialog onCreateDialog(int id) {
        Dialog dialog = null;
        switch(id) {
        case DIALOG_PASSWORD_VERIFICATION:
            LayoutInflater factory = LayoutInflater.from(this);
            final View passwordDialog = factory.inflate(R.layout.password, null);

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

            alert.setTitle("Please enter your password");
            alert.setView(passwordDialog);
            alert.setCancelable(false);
            alert.create();

            alert.setPositiveButton("Ok", new PasswordDialogListenerOk(
                    passwordDialog, getApplicationContext()));
            alert.setNegativeButton("Cancel", new PasswordDialogListenerOk(
                    passwordDialog, getApplicationContext()));

            alert.show();
            break;
        default:
            dialog = null;
        }
        return dialog;
    }

Everything works fine and smooth, but I have no clue WHERE I'm getting back in my ACTIVITY. The dialog disappears, but where is the return point in the activity after the dialog dismisses?

Was it helpful?

Solution

There's not really a distinct "where" for returning back to the activity. It does go to OnResume at some point I suppose, but if you're looking to just do something once the dialog is dismissed, you should just put that code in your listener (in this case you've called it PasswordDialogListener). If there's something specific you want to use it for, you should explain what you're trying to accomplish.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top