When you create an adapter, in its constructor you add the contents of productList . At this point (adapter constructor), productList is most likely empty because the HTTP request to select json is not yet complete. Thus, you get an empty arraylist, and when you do any filtering on the adapter, you will not see anything, because there is nothing to filter.
Remember to update the arraylist (from the adapter) when the data finally enters the onResponse () callback, so you have a link to it to use it for filtering.
I would advise you to follow other tutorials.
Edit:
Add an “incremental” method to the adapter to add new elements:
//In the SwipeListAdapter class add public void add(Product p) { productList.add(0, p); arraylist.add(0, p); notifyDataSetChyanged(); }
Then in your activity, instead of:
productList.add(0, m);
call:
adapter.add(m);
source share