Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 371
Daniele B Avatar asked Sep 18 '25 16:09

Daniele B


1 Answers

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

        }
    });
like image 141
Silvia H Avatar answered Sep 20 '25 07:09

Silvia H