Try to change search.getText()
to s.toString()
public void onTextChanged(CharSequence s, int start, int before,
int count) {
resultText = search.getText().toString()
.toLowerCase(Locale.getDefault());
adapter.filter(resultText);
}
to
public void onTextChanged(CharSequence s, int start, int before, int count) {
resultText = s.toString().toLowerCase(Locale.getDefault());
adapter.filter(resultText);
}
A secondary thing, make materialList = searchItemList
; And searchItemList
empty which will be filled with search items (first run will be same elements of materialList.)
P.S Your adapter should implement Filterable
in this case (implements Filterable
)