Daniele B
Daniele B

Reputation: 20442

Android: how to detect dropdown closing in an AutocompleteTextView

I realized that if a dropdown is currently open in an AutocompleteTextView and you click outside the dropdown, the dropdown is dismissed, but the AutocompleteTextView is not losing the focus.

Can anyone think of a way to detect the dropdown closing?

Upvotes: 4

Views: 2838

Answers (1)

Silvia H
Silvia H

Reputation: 8357

Use AutoCompleteTextView.onDismissListener (Added in API Level 17)

http://developer.android.com/reference/android/widget/AutoCompleteTextView.OnDismissListener.html

autoCompleteTextView.setOnDismissListener(new OnDismissListener() {

        @Override
        public void onDismiss() {
            // TODO Auto-generated method stub

        }
    });

Upvotes: 9

Related Questions