Biology, asked by tonysusanth7652, 1 year ago

On save restore process, why is the fragment oncreate called before its activity

Answers

Answered by mani0004
0

You should not count on a valid Activity until the onActivityCreated() call in the Fragment's life cycle.

Called when the fragment's activity has been created and this fragment's view hierarchy instantiated. It can be used to do final initialization once these pieces are in place, such as retrieving views or restoring state.

The exact reasons why the rebuild order is not linear, I cannot tell you. It is probably more efficient to allow each component to re-start at its own pace rather than forcing a rigid order. For instance, I prefer that my LoaderManager starts as early as possible and we'll worry about the layout for it's content later.

Attachments:
Similar questions