Reputation: 1026
With this code from my Fragment class:
FragmentManager fm = getFragmentManager();
I got null. Why? I found in android doc that sentence:
Note that this will be non-null slightly before getActivity(), during the time from when the fragment is placed in a FragmentTransaction until it is committed and attached to its activity.
But I don't understand it at all. What to do to not get that null?
Upvotes: 2
Views: 1752
Reputation: 1339
Your activity should be an instance of FragmentActivity and call getFragmentManager() from here
Upvotes: 1