My code:
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// t-alk és impresszumhoz
Here are the internals of the Fragment life cycle:
FragmentManager
sets the activity value for a Fragment
performing a state transition:
f.mActivity = mActivity;
f.mFragmentManager = mActivity.mFragments;
f.mCalled = false;
f.onAttach(mActivity);
Also, it sets this value to null, after detaching the Fragment
:
f.mCalled = false;
f.onDetach();
. . .
f.mActivity = null;
f.mFragmentManager = null;
So, The value should not be null, between onAttach()
and onDetach()
, if every thing else is fine.
To be safe, move all such code to onActivityCreated()
;