2

I have this code for showing a dialog with an account picker. This dialog is reached by clicking a button 'authenticate' in another AlertDialog DoLoginDialog.

accountPicker = new AlertDialog.Builder(this)
.setTitle(getString(R.string.common_select_an_account))
.setAdapter(new ArrayAdapter<String>(this,
            android.R.layout.simple_list_item_1, name),
            new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
               if (which < availableAccounts.length) {
                  final Account chosenAccount = availableAccounts[which];
                  authenticator.verifyAccount(chosenAccount, MainActivity.this);
                } else {                     
                   authenticator.addNewAccount(MainActivity.this);
                }
              }}).create();

accountPicker.setCancelable(true);
accountPicker.setCanceledOnTouchOutside(true);

accountPicker.setOnCancelListener(new DialogInterface.OnCancelListener() {
     @Override
      public void onCancel(DialogInterface dialog) {
          if(DEBUG) Log.d(TAG, "OnCancel - AccountPickerDialog");
          showDoLoginDialog();
      }});
accountPicker.show();

Basically, if the user cancel the AlertDialog accountPicker I show again the AlertDialog doLoginDialog.

When I cancel the AlertDialog accountPicker I see these messages in the (unfiltered) log:

Attempted to finish an input event but the input event receiver 
has already been disposed.

It does not cause any problem to the application, but I would like to understand what is happening. I have searched, but could only find more complex situations. This is very basic so I hope to find someone who will help me to understand what is happening here.

Antonio Sesto
  • 2,868
  • 5
  • 33
  • 51

1 Answers1

4

I had the same issue and I found an explanation here

It seems to be a normal behaviour due to the event handling workflow. To avoid this warning, you need to set the dialog as not cancelable (even when touching outside), and add a cancel button within the dialog to dismiss it.

Hope this helps!

Community
  • 1
  • 1
AJoe16
  • 726
  • 6
  • 10