In the FragmentPagerAdapter
I can override destroyItem
method and just remove line super.destroyItem(container, position, object);
@Override
public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) {
//don't destory items after switching
//super.destroyItem(container, position, object);
}
Then fragments will no longer be deleted. But in the new FragmentStateAdapter
I have not found the same method.