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 ?
Asked
Active
Viewed 1,613 times
1
-
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 Answers
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,157
- 15
- 28
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
- 666
- 1
- 8
- 21
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
- 9,144
- 3
- 37
- 51