I am a begginer in Android but I tried to make a custom listview filtering and I it worked somehow. The only problem I have is that the ArrayList that I kept all the values
They have it covered here: https://www.mysamplecode.com/2012/07/android-listview-custom-layout-filter.html
You'll need to call clear() on the arrrat adapter to not hit the indexBoundException and add() on every element, since addAll() is valid only since honeycomb.
@SuppressWarnings("unchecked") @Override protected void publishResults(CharSequence constraint, FilterResults results) {
countryList = (ArrayList)results.values;
notifyDataSetChanged();
clear();
for(int i = 0, l = countryList.size(); i < l; i++)
add(countryList.get(i));
notifyDataSetInvalidated();
}