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 ?
How to Use google places api in android with restrict particular place?
1.6k Views Asked by Sanjay Bhalani At
3
There are 3 best solutions below
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();
}
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