不推荐使用FragmentManager.有替代方法或我现在可以做什么?
PlaceAutocompleteFragment autocompleteFragment = (PlaceAutocompleteFragment) getFragmentManager().findFragmentById(R.id.place_autocomplete_fragment); autocompleteFragment.setOnPlaceSelectedListener(new PlaceSelectionListener() { @Override public void onPlaceSelected(Place place) { // TODO: Get info about the selected place. destination = place.getName().toString(); destinationLatLng = place.getLatLng(); } @Override public void onError(Status status) { // TODO: Handle the error. } });
解决方法
此方法在API级别28中已弃用.
使用FragmentActivity.getSupportFragmentManager()