我正在尝试在我的应用程序中实现适用于 android 的新 Places API,但我似乎无法弄清楚如何为请求设置过滤器。这是我的代码。
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);
如您所见,我遵循了 google here 提供的文档但是我在阅读 API Reference 之后,他们并没有谈论如何实现过滤器。我仍然不知道如何实现 API。
我需要帮助确定 API 的 AutocompleteFilter.create()
参数应该包含哪些内容。我想按城市过滤数据
谢谢
最佳答案
它适用于 Google Play 服务 9.4。
AutocompleteFilter filter = new AutocompleteFilter.Builder()
.setTypeFilter(AutocompleteFilter.TYPE_FILTER_CITIES)
.build();
关于android - 如何使用 Android Places API AutocompleteFilter,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29978325/