I have the following task to do, I need to build a live search from an endpoint.
Now, the thing is I know how to do it but, what I don't know, is how to do it efficient. The small app should do the following:
- Live search from a specific endpoint - a list of over 2000 objects in a json request.
- While loading, the app should display a spinner.
- Refresh the autocomplete list view.
The only solution I know is the following:
I add a menu to the action bar where I add the search view. Inside the activity I will have a fragment with a list view (better when I want to add some clicking on the items), and when the user searches for something (e.g, "around, "a" first, then "ar", etc) then a new request to the server will be made and all the objects that start with "a" will be loaded to the listview and from then on autocomplete will do its work.
In this way I need to load all the data that contain "a" and filter from there.
Now the problem for me is that I need to parse every time the json file, and it is possible I only need 3 records.
As an improvement, I thought of somehow filtering the json big file and retrieving only the json file that I need, but I am not sure if this is possible and if so at what cost.
Does anyone know a better solution?