Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AutoCompleteTextView hide auto complete suggestions

i have an AutoCompleteTextView widget on the view. if it has input focus and I'm trying to change the text in there with:

txtField1.setText("test");

I'm getting suggestions list appears on the screen. How do I hide it? is it possible to update the text not showing suggestions?

like image 505
Alex D Avatar asked Dec 02 '11 04:12

Alex D


2 Answers

I'll leave this here, in case someone needs it in the future, like I did.

yourAutoCompleteTextView.dismissDropDown();

will make the list with suggestions disappear from the screen.

like image 67
jRicardo Avatar answered Nov 04 '22 04:11

jRicardo


I suggest some methods

1)If you want to make "test" like hint of autocomplete textView then do like this,

 txtField1.setHint("test");

2)If you need to fill up the text view with "test" and also need to prevent the suggestion increase the threshold level for auto complete textview ,

   txtField1.setThreshold(5);

if you use threshold it will show suggestion after 5 character (according to the code posted in above line). If you need try to set different word and also try to avoid suggestion , change the threshold dynamically based on length of string.

like image 26
Karthi Avatar answered Nov 04 '22 04:11

Karthi