how do i add Search Functionality in my android app? i have a listview in which i want to add search functionality , i have the code but i dont know how do i integrate it pr
Since you are using android's array adapter, you can use its getFilter() method too. So you just have to change minor things in your code.
Instead of setting array adapter like this
list1.setAdapter(new ArrayAdapter(this,android.R.layout.simple_list_item_1, array));
Create a private variable outside of the methods
private ArrayAdapter adapter;
Then initialize and set it
adapter = new ArrayAdapter(this,android.R.layout.simple_list_item_1, array);
list1.setAdapter(adapter);
Now text changed method can call MainActivity.this.adapter.getFilter().filter(cs);
without any problem