I have a list view and above that one edit text. In edit text, data is searched from the list view and show in edit text. In the list view some data are two words. For example, list view contains “car”, “red car”, “blue car” . Now if I type c in edit text, it shows only car, not the other two. How can I search all the above three, when c is typed. Here is my code…
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
wordlength = ed.getText().length();
editsort.clear();
for(int i=0;i<word.length;i++){
if(wordlength<=word[i].length()){
if(ed.getText().toString().equalsIgnoreCase((String) word[i].subSequence(0, wordlength))){
editsort.add(word[i]);
}
}
}
Thanks…
If
wordis the array of strings which you want to search in: