Question

I'd like to use AutoCompleteTextView dropdown to show both history (if no characters have been entered into the textbox) and webservice based suggestions (when at least one character has been entered). The backing Adapter is implemented and working. The only problem left is the visibility of the dropdown. I've tried several ideas, including the one below:

public class InstantAutoCompleteTextView extends AutoCompleteTextView {

(Constructors omitted)

@Override
public boolean enoughToFilter() {
    return true;
}

@Override
public boolean onTouchEvent(android.view.MotionEvent event) {
    boolean result = super.onTouchEvent(event);
    if (event.getAction() == MotionEvent.ACTION_UP)
    {
        if (!isPopupShowing()) {
            performFiltering(getText(), 0);
        }
    }
    return result;

}

The dropdown does show if you click on the text input box. However, when you click it again it disappears and then reappears (instead of just disappearing). Is there any way to stop it from reappearing in this situation?

Was it helpful?

Solution

The solution is a different approach, shown in https://stackoverflow.com/a/5546070/2440027 . Basically it works by removing the adapter temporarily

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top