Skip to content Skip to sidebar Skip to footer

Search On Listview (activity Extends Listactivity)

i extend ListActivity and bind ListView in my activity. applied filter to listview. the filter is working fine when use emulater, because i have keyboard of my laptop. but the prob

Solution 1:

Put an EditText somewhere, like on top of your listView, then add a TextWatcher like :

    TextWatcher filterTextWatcher = new TextWatcher() {

        public void afterTextChanged(Editable s) {
        }

        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        }

        public void onTextChanged(CharSequence s, int start, int before, int count) {
            _myAdapter.getFilter().filter(s);
        }
    };
    _filterText = (EditText) findViewById(R.id.search_box);
    _filterText.addTextChangedListener(filterTextWatcher);

Post a Comment for "Search On Listview (activity Extends Listactivity)"