I am trying to implement the new Places API for android in my app and I cant seem to figure out how to set a filter to the request. Here is my code.
LatLng southWest = new LatLng(85, -180);
LatLng northEast = new LatLng(-85, 180);
LatLngBounds bounds = new LatLngBounds(southWest, northEast);
AutocompleteFilter filter = AutocompleteFilter.create(WHAT SHOULD GO HERE?);
PendingResult result = Places.GeoDataApi.getAutocompletePredictions(mGoogleApiClient,
search.getText().toString(), bounds, filter);
As you can see I followed the documentation provided by google here but I they dont talk about how to implement the filter, after reading the API Reference I still cant figure out how to implement the API.
I need help figuring out what should go in as the parameter for AutocompleteFilter.create()
for the API. I want to filter the data by cities
Thanks
It works on Google Play Service 9.4.
AutocompleteFilter filter = new AutocompleteFilter.Builder()
.setTypeFilter(AutocompleteFilter.TYPE_FILTER_CITIES)
.build();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With