I have been searching google and stack overflow for an answer to this question but haven't found any answers. I'm building an android app and need an auto complete field that returns suggestions for city names to be used in a search. The only guides and examples I have found only show how to implement AutocompleteTextView with a String array resource.
I already know how to make the REST call itself and parse the returning data. I just want to know the best way to implement it in an autocompleteview. The url that makes the RESTful call simply takes the city prefix that needs to be more than 1 character and returns the results in JSON.
Example:
URL: www.mysite.com/cities/state_id/mi
Returns:
[{"city_id":6595,"city":"Mi Wuk Village"},{"city_id":6877,"city":"Michigan Bluff"},{"city_id":6724,"city":"Middletown"},{"city_id":6594,"city":"Midpines"},{"city_id":5047,"city":"Midway City"},{"city_id":7415,"city":"Milford"},{"city_id":7337,"city":"Mill Creek"},{"city_id":6295,"city":"Mill Valley"},{"city_id":5857,"city":"Millbrae"},{"city_id":7183,"city":"Mills Orchard"},{"city_id":7339,"city":"Millville"},{"city_id":6376,"city":"Milpitas"},{"city_id":7338,"city":"Mineral"},{"city_id":5698,"city":"Minkler"},{"city_id":4208,"city":"Mint Canyon"},{"city_id":4406,"city":"Mira Loma"},{"city_id":3687,"city":"Miracle Mile"},{"city_id":3945,"city":"Mirada"},{"city_id":5631,"city":"Miramonte"},{"city_id":6802,"city":"Miranda"},{"city_id":4201,"city":"Mission Hills"},{"city_id":6270,"city":"Mission Rafael"},{"city_id":5063,"city":"Mission Viejo"}]
I was thinking about doing something similar to this implementation with SQLLite but this code seems very inefficient since it creates a new adapter everytime the text changes in the CustomAutoCompleteTextChangedListener which implements TextWatcher.
Any input would be much appreciated.