I need to override a getFilter()
method from the class ArrayAdapter
and i found the source code from here in the github
//package
After some help from stackoverflow community i removed the exception and later i found out that the suggestions that are returned doesn't really change because the mObjects
was returned from the super class or base class. The problem was the there were two public methods getCount()
and getItem(int position)
which gets the count and fetches the list from mObjects from the base class. So i just have to add those two methods in my class..
public int getCount() {
return mObjects.size();
}
public T getItem(int position) {
return mObjects.get(position);
}
Now mObjects
of the derived class will be returned. Which are the updated in the dropdown list in the UI.
I am not a java expert, but this solves my problem. If you have any suggestions to make the code better please add it in comments or feel free to edit the answer.!