My app uses a MultiColumnListView
(https://github.com/huewu/PinterestLikeAdapterView) and as its name says it helps creating multi column list views.
T
You need to clear older myList.clear()
and then call adapter.notifyDataSetChanged()
Update:
Change your code like:
public MiAdaptadorListaComercios(Context c,List<Comercio> myList){
this.contexto = c;
this.myList = new ArrayList<Comercio>();
}
Also, do it like
myList.clear();
myList.addAll(originalList);
just change your myList
and call adapter.notifyDataSetChanged()
don't set a new adapter each time.
In the constructor of your custom adapter do call super
that takes ArrayList as the argument.
call this:
public MiAdaptadorListaComercios(Context c,List<Comercio> myList){
super(c,0,myList);
this.contexto = c;
this.myList = myList;
}
You can keep the adapter as it is the problem is in this line:
myList = filteredList;
instead of changing the reference you should change the list itself.
myList.clear();
myList.addAll(filteredList);
By doing this you will loose your original list to I would suggest keeping another list call ed originalList which will have the complete list and initialize myList in onCreate by:
myList=new ArrayList(originalList);
so every time you want to re-set just call:
myList.clear();
myList.addAll(originalList);
and in
for(Comercio co : originalList)
{
if(co.getName().contains(filer))
{
filteredList.add(co);
}
}