android fragment执行流程

1. onAttach ------called once the fragment is associated with its activity

2. onCreate-------called to do initial creation of the fragment

3. onCreateView---creates and returns the view hierarchy associated with the fragment

4.onActivityCreated ---tells the fragment that its activity has completed its own {@link Activity#onCreate Activity.onCreaate}

5.onStart----------makes the fragment visible to the user (based on its containing activity being started)

6.onResume-----makes the fragment interacting with the user (based on its containing activity being resumed).

7. onPause----- fragment is no longer interacting with the user either because its activity is being paused or a fragment operation is modifying it in the activity.

8.onStop------fragment is no longer visible to the user either  because its activity is being stopped or a fragment operation is modifying it  in the activity.

9.onDestroyView ------allows the fragment to clean up resources  associated with its View.

10.onDestroy---------called to do final cleanup of the fragment's state.

11.onDetach--------called immediately prior to the fragment no longer   being associated with its activity

你可能感兴趣的:(Fragment)