Search on ListView when the class extends ListActivity

141 Views Asked by At

When I want to search on a ListView and the class extends Activity or AppCompatActivity I'm using this below codes and it works correctly.


etSearch.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {

            }

            @Override
            public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {

                MainActivity.this.listAdapter.getFilter().filter(charSequence.toString());

            }

            @Override
            public void afterTextChanged(Editable editable) {

            }
        }); 

But when the class extends ListActivity and I'm using the codes, it's not working.I saw this post, but it's not working too.

How can I search on a ListView when the class extends ListActivity?

Thanks in advance.

0

There are 0 best solutions below