I've an Activity
with a ViewPager
, 3 tabs, 3 Fragment
s, and these fragments are all the same class but with different arguments when created so they are filled with a different list each one.
MainActivity
> SectionsPageAdapter
@Override
public Fragment getItem(int position) {
Fragment fragment = new MyFragment();
Bundle args = new Bundle();
args.putInt(MyFragment.TYPE, position);
fragment.setArguments(args);
return fragment;
}
The problem is that I need to refresh the Adapter
of an individual Fragment
onClick
, but the adapter is always the last created Fragment
Adapter
.
How can I solve this without duplicating the fragment class 3 times with different names?