地方建议未加载到地方自动完成中

时间:2019-02-13 10:39:50

标签: android google-places-api googleplacesautocomplete

PlacesAutoComplete没有显示建议

AutocompleteSupportFragment autocompleteFragment;
autocompleteFragment = (AutocompleteSupportFragment)getSupportFragmentManager().findFragmentById(R.id.autocomplete_fragment);
autocompleteFragment.setPlaceFields(Arrays.asList(Place.Field.ID, Place.Field.NAME));
autocompleteFragment.setOnPlaceSelectedListener(new PlaceSelectionListener() {
            @Override
            public void onPlaceSelected(Place place) {
                // TODO: Get info about the selected place.
                //Log.i(TAG, "Place: " + place.getName() + ", " + place.getId());
                full_address.setText(place.getAddress().toString());
                pLoc=place.getAddress().toString();
                Log.i("TAG place", "Place: " + place.getAddress());
            }
            @Override
            public void onError(Status status) {
                // TODO: Handle the error.
                Log.i("TAG Place", "An error occurred: " + status);
            }
        });
autocompleteFragment.setHint("Location");

Placesautocomplete可以正常运行,但已弃用。

当我迁移到自动完成而不是Placeautocomplete时,出现如下错误:

帮我解决这个问题

enter image description here

0 个答案:

没有答案