• Have Any Question?
  • contact@eitworld.com

Fragment life cycle





There are several methods which define the life cycle of the fragments. The diagram of fragment life cycle and methods are as follows:

fragment-life-cycle

  • onAttach() : when any fragment is added first time then this method is called.
  • onCreate() : when fragment creates then this method is called by the android system.
  • onCreateView() : when fragment is displayed first time on the screen then this method is called by the android system.
  • onActivityCreated() : this method is called by android system when host activity creates.
  • onStart() : This method is called when the fragment user interface visible on the screen.
  • onResume() : When we pause the fragment and resume it then this method is called by the android system.
  • onPause() : When fragment is paused then this method is called by the android system.
  • onStop() : When fragment stops then this method is called by the android system.
  • onDestroyView() : To destroy the fragment view, this method is called by the android system.
  • onDestroy() : When fragment destroy then this method is called.


Real Time Web Analytics