Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Since the Android getFragmentManager() API is deprecated, is there any alternative?

Tags:

java

android

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.             }         }); 

deprecation strike image

like image 407
Zubair Rajput Avatar asked Aug 08 '18 02:08

Zubair Rajput


People also ask

Is Fragmentactivity deprecated?

Public methods. Print the Activity's state into the given stream. Return the FragmentManager for interacting with fragments associated with this activity. This method is deprecated.

Is Fragment Manager deprecated?

Deprecated: Deprecated in Java.

What is getFragmentManager?

getFragmentManager() Return the FragmentManager for interacting with fragments associated with this fragment's activity.


1 Answers

This method was deprecated in API level 28.

Use FragmentActivity.getSupportFragmentManager()

like image 164
faskN Avatar answered Sep 30 '22 01:09

faskN