I have an Activity with an AutoCompleteTextView
and a ListView
with an adapter that extends BaseAdapter
.
When the Activity starts and AutoCompleteTextView
is empty, ListView
show a full list of items. When user starts typing on AutoCompleteTextView
and selects a hint, an OnItemClickListener
launch and I call:
adapter.n开发者_高级运维otifyDataSetChanged();
This reloads the adapter with only some items. This works perfect, but when the user cleans the AutoCompleteTextView
, nothing happens.
I want to associate a Listener
that launches when the user cleans, without pressing Enter.
Are there any listener
that do this?
Thanks!
you could provide your own implementation of TextWatcher
interface that checks whether user input has been cleared and add it to you AutoCompleteTextBox
using addTextChangedListener()
method
Thanks wjeshak!!! Now works perfect.
This is the method that I've overrided, it can be useful for somebody :
@Override
public void onTextChanged(CharSequence s, int start, int before,int count) {
if ( start == 0 && before == 1 && count == 0) {
adapter.notifyDataSetChanged();
}
}
精彩评论