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()
关于java - 由于不推荐使用 Android getFragmentManager() API,还有其他选择吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51737667/