Fcoder
Fcoder

Reputation: 9216

Change value of AutoCompleteTextView

I have a AutoCompleteTextView and in setOnItemClickListener i want to check when user type an special text, AutoCompleteTextView clears and set to "". But when i do this an get an Stack Overflow Error. In general, every change in setOnItemClickListener generate Error!! i want to set some changes in my AutoCompleteTextView! How i can do this?

Upvotes: 1

Views: 4709

Answers (1)

207
207

Reputation: 3804

Use a TextChangedListener instead of onItemListener

textView.addTextChangedListener(new TextWatcher() {

    public void onTextChanged(CharSequence s, ....){
        //if "s" is your "special" text clear the textview
    }
});

Upvotes: 7

Related Questions