I am trying to find out if AutoCompleteTextView dropdown is shown/hidden. On button click I want to show dropdown (if it's hidden), and hide it (if it's showing). For this purpose I use method isPopupShowing()
, but it always returning FALSE.
Example:
@Override
public void onClick(View view) {
if (view.getId() == button.getId()) {
if (autoCompleteTextView.isPopupShowing()) {
autoCompleteTextView.dismissDropDown();
} else {
autoCompleteTextView.showDropDown();
}
}
}
When AutoCompleteTextView lost focus, the dropdown disappears. So the dropdown is always invisible when you click the button.
Simply add a new boolean property to your listener to remember last state.