Reputation: 446
Im using one edittext and listview in my app. i need to display the list according to the text in edittext.
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
// TODO Auto-generated method stub
adapter.getFilter().filter(s.toString());
}
eg if i type the value as "an" means it display like
Andorra
Angola
Antigua
But i need like this
Andorra
Angola
Antigua
Bangladesh
Bhutan
Canada
Thanks in advance
Upvotes: 0
Views: 285
Reputation: 21191
Here is the example exactly which you are looking for. check this
Here is the simple logic with `Arrays
and addTextChangedListener
for EditText
In Change the block of code as like this.
if (textlength {
if ((String)listview_array[i].contains(et.getText().toString()))
{
array_sort.add(listview_array[i]);
}
I have replace equalsIgnorecase
with contains
. Please check the difference here
Upvotes: 2