I am using a ViewPager2 together with a FragmentStateAdapter.
public class MyAdapter extends FragmentStateAdapter {
public MyAdapter(@NonNull Fragment fragment) {
super(fragment);
}
@NonNull
@Override
public Fragment createFragment(int position) {
return MyFragment.newInstance(MyClass.func(position));
}
@Override
public int getItemCount() {
return MyClass.NUM;
}
}
Unfortunately, calling notifyDataSetChanged() on the adapter has no effect at all (calling notifyItemChanged(position) works fine).
How can I solve this?