If I have a FragmentStatePagerAdapter
with a many Fragment
s like this:
public class MyFragment extends Fragment {
View myView;
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState {
myView = view.findViewById(R.id.my_view);
}
}
Now suppose I scroll to some other page...does this leak the destroyed views of other pages that are off screen(Because I have a ref to them - myView
s)?
Does doing this help:
@Override
public void onDestroyView() {
myView = null;
}