Fragment is a piece of activity for user interface. A single activity can contain multiple fragments and many fragments can be reused in many, different activities. In Activity we can add or remove fragment when application is running and a fragment can be used multiple activities.
onAttach(Activity) called once the fragment is associated with its activity.
onCreate(Bundle) called to do initial creation of the fragment.
onCreateView(LayoutInflater, ViewGroup, Bundle) creates and returns the view hierarchy associated with the fragment.
onActivityCreated(Bundle) tells the fragment that its activity has completed its own Activity.onCreate().
onViewStateRestored(Bundle) tells the fragment that all of the saved state of its view hierarchy has been restored.
onStart() makes the fragment visible to the user (based on its containing activity being started).
onResume() makes the fragment interactive.
onPause() is called when fragment is no longer interactive.
onStop() is called when fragment is no longer visible.
onDestroyView() allows the fragment to clean up resources.
onDestroy() allows the fragment to do final clean-up of fragment state.
onDetach() It is called immediately prior to the fragment no longer being associated with its activity.