Java 无法在用于Google Places 2019更新的setTypeFilter()中使用两个TypeFilter

Java 无法在用于Google Places 2019更新的setTypeFilter()中使用两个TypeFilter,java,android,google-places-api,Java,Android,Google Places Api,我已使用以下工具升级到新的Google Places: 'com.google.android.libraries.places:places:2.0.0' 我在我的布局中实现了一个AutoCompleteSupportFragment,在该片段中,用户将键入他们的位置或目的地。然后,信息将被放入底部SheetriderFragment中 我希望能够过滤地址和机构,但我不能在单独的线路上同时过滤地址和机构 在研究中(关于这个主题的研究不多),提到了使用 TYPE_FILTER_ADDRESS|

我已使用以下工具升级到新的Google Places:

'com.google.android.libraries.places:places:2.0.0'
我在我的布局中实现了一个AutoCompleteSupportFragment,在该片段中,用户将键入他们的位置或目的地。然后,信息将被放入底部SheetriderFragment中

我希望能够过滤地址和机构,但我不能在单独的线路上同时过滤地址和机构

在研究中(关于这个主题的研究不多),提到了使用

TYPE_FILTER_ADDRESS|TYPE_FILTER_ESTABLISHMENT
我试着放:

places_location.setTypeFilter(TYPE_FILTER_ADDRESS|TYPE_FILTER_ESTABLISHMENT);
但出现了以下错误:

setType Filter(com.google.android.libraries.places.api.model.Type Filter) in AutocompleteSupportFragment cannot be applied to (int)
我怎样才能解决这个问题

布局

<fragment
                android:id="@+id/places_location"
                android:layout_weight="5"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:name="com.google.android.libraries.places.widget.AutocompleteSupportFragment" />

<fragment
                android:id="@+id/places_destination"
                android:layout_weight="5"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:name="com.google.android.libraries.places.widget.AutocompleteSupportFragment"/>
同时

// Create a RectangularBounds object.
RectangularBounds bounds = RectangularBounds.newInstance(
    new LatLng(45.282785, -66.235011),
    new LatLng(45.333059, -65.842197));

places_location.setCountry("ca");
places_location.setLocationBias(bounds);
places_location.setTypeFilter(TypeFilter.REGIONS);
places_location.setTypeFilter(TypeFilter.CITIES);
places_location.setTypeFilter(TYPE_FILTER_ADDRESS|TYPE_FILTER_ESTABLISHMENT);

不允许您编写多个筛选器,如果您编写两个筛选器,则该筛选器将不起作用;如果您希望同时使用机构和地址,则不要编写任何筛选器,因为这两个筛选器同时不起作用。如果你只想得到附近位置的建议,那么位置偏差对你来说是完美的,它会在建议中为你提供地址和机构

RectangularBounds bounds = RectangularBounds.newInstance
(new LatLng(45.282785, -66.235011),new LatLng(45.333059, -65.842197));
places_location.setCountry("ca");
places_location.setLocationBias(bounds);
RectangularBounds bounds = RectangularBounds.newInstance
(new LatLng(45.282785, -66.235011),new LatLng(45.333059, -65.842197));
places_location.setCountry("ca");
places_location.setLocationBias(bounds);