Search code examples
androiddialogshowdialog

Dialog does not open when called shortly after being dismissed


In my app, the user logs in with a custom made login dialog. The user can confirm and exit the dialog in two ways:

  1. Press the Enter/Done button in the password box.
  2. Press the OK button.

When the user has confirmed, the provided credentials are verified. If the credentials were incorrect, the dialog will reappear. This does only work if the user presses the Enter/Done button in the password box and not if the OK button is pressed. I use the same code for both the TextView.OnEditorActionListener and the DialogInterface.OnClickListener. I've tried debugging the code and I've discovered that in both cases, the boolean android.app.Activity.showDialog(int id, Bundle args) return true, which tells if the dialog was displayed or not.


Solution

  • I believe your best bet is to just create a new dialog. Should'nt be to hard.

    UPDATE:

    Also you could set it to

    setVisibility(View.GONE);
    

    And then when you want it to be show again

     View.VISIBLE