I\'ll try to show a map in my Android application on a fragment named RoeteFragment. If I debug my code I see that the method onMapReady is never c
The map fragment is part of a layout you inflate to another fragment (let's call it parent). The inflated fragment becomes a child fragment NOT of the activity BUT of the parent fragment. You have to ask the parent fragment's child fragment manager:
Note: Just extend simple fragment public class MapsFragments extends Fragment implements OnMapReadyCallback {}
XML file
and
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
Log.d("check","onCreateView");
// Inflate the layout for this fragment
View view= inflater.inflate(R.layout.fragment_maps_fragments, container, false);
// Gets the MapView from the XML layout and creates it
final SupportMapFragment myMAPF = (SupportMapFragment) getChildFragmentManager()
.findFragmentById(R.id.map);
myMAPF.getMapAsync(this);
return view;
}`