I have two fragments. One is part of mobile_navigation.xml and is called AllSpotsFragment. The other is a usual fragment and is called SpotInfoFragment.
With a certain action on the AllSpotsFragment fragment, a second SpotInfoFragment fragment is added and displayed on the screen. This happens as follows:
requireActivity().getSupportFragmentManager().beginTransaction()
.add(R.id.fragment_container_all_spots, spotInfoFragment)
.commit();
However, due to the fact that one fragment replaces the contents of the container in another, the state of the AppBar does not change in any way. For example, when switching from an AllSpotsFragment fragment to any other fragment from mobile_navigation.xml, the AppBar header changes to the fragment header and the left arrow icon appears to return to the previous fragment. How do I achieve the same result when running a SpotInfoFragment fragment?