由于不推荐使用Android getFragmentManager()API,是否还有其他选择? [英] Since the Android getFragmentManager() API is deprecated, is there any alternative?
本文介绍了由于不推荐使用Android getFragmentManager()API,是否还有其他选择?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
FragmentManager
已过时.有替代方法还是我现在该怎么办?
FragmentManager
is deprecated. Is there an alternative or what can I do now?
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中弃用.
This method was deprecated in API level 28.
使用FragmentActivity.getSupportFragmentManager()
这篇关于由于不推荐使用Android getFragmentManager()API,是否还有其他选择?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文