0

I am making a restaurant recommender system using Zomato's api. Zomato only allows 20 restaurant per query (with a max of 100 restaurant), so I have to query 5 times to get the most. I put the query in a list and display it through TextView (and ImageView for the thumbnail).

I want to create a button over the list of the restaurants that are displayed, for sorting. So there will be a "Price" button, "Distance" button, "Rating" button, where they will sort the list based on what it's written. But I don't know if it's possible to dynamically sort the TextView without clearing the list...

Sorry for bad English :)

Thank you so much

kvnrichie
  • 11
  • 6

1 Answers1

0

I am kind of assuming that you keep the results of the requests around. you can sort those and pass them to your adaptor. Call notifyDatasetChanged() on the adaptor once the sort is done.

check this out

Community
  • 1
  • 1
  • Yes yes! I want to sort the requests without changing the page I am in. Is it possible? I think it's like Ajax in php, where you can update the content of a page without reloading it. – kvnrichie Apr 21 '17 at 08:40