Trying to implement search functionality in list view having problem in search,here i am placing code where i am getting error
friendsearch.addTextChangedListener(new TextWatcher() {
public void onTextChanged(CharSequence cs, int arg1, int arg2, int arg3) {
// When user changed the Text
FriendsActivity.this.adapter.getFilter().filter(cs);
//*in the above line i am getting error.*
}
public void beforeTextChanged(CharSequence arg0, int arg1, int arg2,
int arg3) {
// TODO Auto-generated method stub
}
public void afterTextChanged(Editable arg0) {
// TODO Auto-generated method stub
}
});
It seems that
FriendsActivity.this.adapterhas typeListAdapter. If it’s actually array adapter then try:EDIT:
You have following class:
class ListAdapter extends BaseAdapterin your sources. BaseAdapter doesn’t implement filter. So you need to implement it manually. Check this tutorial: http://www.survivingwithandroid.com/2012/10/android-listview-custom-filter-and.html