---
title: "Filter a list when text is change in a List"  
description: "Filter a list when text is change in a List"  
author: "Lillian Martin"  
published: 2015-03-20  
updated: 2015-03-20  
canonical: https://www.mindstick.com/forum/23035/filter-a-list-when-text-is-change-in-a-list  
category: "android"  
tags: ["android", "listview"]  
reading_time: 1 minute  

---

# Filter a list when text is change in a List

```
EditText inputSearch = (EditText)getView().findViewById(R.id.inputGroupSearch);   
inputSearch.addTextChangedListener(new TextWatcher() {         @Override        public void onTextChanged(CharSequence cs, int arg1, int arg2, int arg3) {            // When user changed the Text          
        Myadapter.getFilter().filter(cs);        }})
```

but this [code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii) is not running

## Replies

### Reply by Manoj Pandey

Add following code for filter list on edittext type

```
editText = (EditText) view.findViewById(R.id.filerText);     editText.addTextChangedListener(new TextWatcher() {           @Override         public void onTextChanged(CharSequence cs, int arg1, int arg2, int arg3) {            YourCustomAdapter Myadapter= (YourCustomAdapter) getListAdapter();                  Myadapter.getFilter().filter(cs);         }          @Override         public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) { }          @Override         public void afterTextChanged(Editable arg0) {}     });
```

\


---

Original Source: https://www.mindstick.com/forum/23035/filter-a-list-when-text-is-change-in-a-list

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
