I have a AutoCompleteTextView with a list of items, and I need select one of them...
I am doing something like:
myAutoCompleteTextView.setListSelection( index);
and...
myAutoCompleteTextView.setText( index);
but don't work... How can I set a item by default?
This will not work because setText
takes a CharSequence
.
myAutoCompleteTextView.setText(index);
public final void setText (CharSequence text)
Source: http://developer.android.com/reference/android/widget/TextView.html#setText(java.lang.CharSequence)
If you have a data structure such as a List<String> data
, you can do something like this:
myAutoCompleteTextView.setText(data.get(index));
Source: http://developer.android.com/reference/android/widget/AutoCompleteTextView.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With