Issue
There is lack of information about nested Fragments
in the web, so here is my question.
Since child fragments can be added only dynamically, what is the best place to do this and why? I mean what is best callback to perform this operation:onCreate()
,onCreateView()
, onActivityCreated()
, etc.?
EDIT:
I just tested it and it seems there is no difference, it's possible to commit child fragments even in onAttach()
callback of parent fragment.
Solution
Well based on intuition and the general idea about the Fragment lifecycle. I'd say you can safely do it in onCreateView()
. But I'd test this a little if I was you. Embeded fragments should still be managed by the activity so I'm pretty sure it should be possible to do it earlier like in onCreate()
or onAttach()
.
Answered By - Warpzit
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.