dismissDropDown() on AutoCompleteTextView

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

dismissDropDown() on AutoCompleteTextView

Postby Daniel_sk » Sun Sep 13, 2009 2:53 pm

Hi guys,
I am new member on this excellent forum.
I have a problem and I literally checked every page that google found me about this method, to no avail.

I have AutoCompleteTextView and a button that uses setText() for a fast text input with a preset text (it sets the text on the AutoCompleteTextView). Now that works good but the drop-down list shows up, and this is annoying - because it makes no sense, the text is already entered and the drop-down list shows only the same entry. I want to block the drop-down list in case the text is entered by setText().

AutoCompleteTextView has a dismissDropDown() method (and isPopupShowing()), but calling this method right after setText will not hide the drop-down list, because it's not shown yet. The drop-down list is delayed, so that the call has no effect. I was not able to find an event that's called after the drop-down list is displayed... (TextChangedListener with all it's methods is called before the drop-down list).

Thank you for your help.

Regards,
Daniel
Daniel_sk
Freshman
Freshman
 
Posts: 3
Joined: Sun Sep 13, 2009 2:44 pm

Top

Postby yaj786 » Mon Sep 14, 2009 4:10 pm

Try this: once the pre-set text button is set, use autocompletetextview.setThreshold() and set it to something high (like 100). This should make sure the drop down doesn't show.

Then you can set an on focuschangelistener to set the threshold back to something normal, like 3.

Let me know if it works. :)
yaj786
Developer
Developer
 
Posts: 33
Joined: Fri Jul 10, 2009 7:37 am

Postby Daniel_sk » Mon Sep 14, 2009 6:29 pm

Excellent idea, it worked! Thank you so much.
I reset the threshold in the "onTextChanged" listener, because my autoCompleteTextView has always focus somehow...
Daniel_sk
Freshman
Freshman
 
Posts: 3
Joined: Sun Sep 13, 2009 2:44 pm

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: Exabot [Bot] and 6 guests