I am writing an application (android / ios) in which the user is prompted to enter a street name, for example, in the city of Novosibirsk. It is necessary that when entering, say, a certain number of characters, he was asked to choose from a list of matches ...

The question is whether there are already somewhere gathered street names or free services ... or is the only solution to manually create arrays of street names for each city inside the application? :()

ps. I apologize in advance - not sure what the correct label can be set for this issue.

  • Break openstreetmaps, or can try to “borrow” the data from Yandex and Google - their GeoIP in a reasonable amount is free to me - gecube
  • 2
    does not apply to programming. although it seems from the topic of the question that he is a programmer, in fact the author asks for suggestions where to get a database with street names - Max Mikheyenko
  • KLADR and FIAS to help you. - user194374
  • Use Yandex.Geocoder. Absolutely Free Stuff - German Polyansky

1 answer 1

You can use AutoCompleteTextView

private static final String[] COUNTRIES = new String[] { "Belgium", "France", "Italy", "Germany", "Spain" }; ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_dropdown_item_1line, COUNTRIES); AutoCompleteTextView textView = (AutoCompleteTextView) findViewById(R.id.countries_list); textView.setAdapter(adapter); 

But if there are many cities, then the list of cities is better to receive from some external source. When you change the text in your AutoCompleteTextView, get a list of cities that start with the entered text and update the adapter.