Search on ListView when the class extends ListActivity

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.

链接地址: http://www.djcxy.com/p/93388.html

上一篇: 用RecyclerView过滤

下一篇: 当类扩展ListActivity时,在ListView上搜索