OnStart () activity is called before the onActivityCreated () fragment

I had a problem calling my fragment onActivityCreated()method after calling the activity method onStart(). Does this mean that my method onCreate()ends after onStart()? It cannot be so. Really? When is my fragment called in my activity life cycle onActivityCreated()? Also, if I have multiple fragments, how can I control the order of the onActivityCreated()fragment calls ?

In my activity:

@Override
protected void onStart() {
    super.onStart();
    methodA(); // this is called ...
}

In my snippet:

    @Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    methodB(); // ... before this
}
+4
source share
1 answer

the onActivityCreated () method is called after my onStart () method is called

, onActivityCreated() .

, -, , onCreate() onStart()? ... ?

! , onCreated() Activity onActivityCreated() . , .

, . enter image description here

Google: onStart()

, . onResume(), onStop(), .

: onActivityCreated()

, . , , , . , setRetainInstance (boolean) , , . onCreateView (LayoutInflater, ViewGroup, Bundle) onViewStateRestored (Bundle).

:

, , onActivityCreated() ?

, . .

+6

All Articles