1

Hey Guys i basically i want to create one application that have Autocomplete TextView and show place according user search i just restrict user show only india's city name not other. can any one know ?

Sanjay Bhalani
  • 2,424
  • 18
  • 44
  • Possible duplicate: http://stackoverflow.com/questions/717019/how-to-display-only-one-country-or-a-specific-area-in-google-maps-using-the-api – Android Enthusiast Feb 12 '16 at 11:41

3 Answers3

1

To search places bounded to only India , you can use setBoundsBias() in your code.Google now provides Autocomplete widget which makes things even simpler. Please see this link: https://developers.google.com/places/android-api/autocomplete

Yyy
  • 2,285
  • 16
  • 29
0

Create a filter and setCountry as India in the filter and set the filter in the PlaceAutoComplete fragment or intent.

AutocompleteFilter typeFilter = new AutocompleteFilter.Builder()
    .setCountry("IN")
    .build();
autocompleteFragment.setFilter(typeFilter);
vishal gaurav
  • 686
  • 1
  • 9
  • 24
0

This worked for me

try {
                AutocompleteFilter typeFilter = new AutocompleteFilter.Builder()
                        .setTypeFilter(AutocompleteFilter.TYPE_FILTER_ADDRESS)
                        .setCountry("au")
                        .build();
                Intent intent = new PlaceAutocomplete.IntentBuilder
                        (PlaceAutocomplete.MODE_FULLSCREEN)
                        .setFilter(typeFilter)                         
                        .build(ProfileActivity.this);
                startActivityForResult(intent, REQUEST_SELECT_PLACE);
            } catch (GooglePlayServicesRepairableException |
                    GooglePlayServicesNotAvailableException e) {
                e.printStackTrace();
            }
Quick learner
  • 10,632
  • 4
  • 45
  • 55