zachowaj instancje fragmentów wewnątrz FragmentPagerAdapter
Czy można zachować instancję każdego fragmentu utworzonego dlaFragmentPagerAdapter
w środkuFragmentPagerAdapter
?
Coś takiego:
@Override
public Object instantiateItem(ViewGroup container, int position)
switch(position){
case 0:
fragment0 = super.instantiateItem(container, position);
return fragment0;
case 1:
fragment1 = super.instantiateItem(container, position);
return fragment1;
default:
return super.instantiateItem(container, position);
}
}
Czy napotkam problemy z pamięcią?
Chodzi o to, żeby zrobić coś takiegoMyFragmentPagerAdapter.fragment0
w celu uzyskania odniesienia do fragmentu.