I'm learning about fragments, and in the app that I'm making I have a bottom navigation bar, and the first one has a fragment with a ViewPager2. For the viewpager2 I created a custom adapter that extends FragmentStateAdapter, first I used the constructor that receives a FragmentActivity, and the I used the constructor that receives a FragmentManager and a Lifecycle. The way I used them was like this:
CustomAdapter adapter = new CustomAdapter(getActivity());
CustomAdapter adapter = new CustomAdapter(getChildFragmentManager(), getLifeCycle());
Both seemed to work fine, but I'm wondering what is the difference between using one or the other and why it is getChildFragmentManager() and not getFragmentManager(), on the second adapter.
Side note: Just to be clear I only used one of the cosntructors at a time.