Reputation: 1323
When we create a fragment , we must have an activity (which is created and exist) , but i have found In Fragment life cycle onActivityCreated
method , which is give me an idea , that the fragment created first, then the activity ,which is does not make sense , so could anyone explain the misunderstanding here ?
Upvotes: 0
Views: 535
Reputation: 93561
onActivityCreated is called when the Activity's onCreate is finished. It tells you the activity is fully initialized and capable of being used. If you have need to access Activity variables that are initialized in onCreate of the Activity, you can safely do it in onActivityCreated.
Upvotes: 3