-->

Encrypting your link and protect the link from viruses, malware, thief, etc! Made your link safe to visit.

Fragment Lifecycle with Activity Lifecycle

A fragment lifecycle is quite similar to an activity, but it has extra methods. It also needs to interact with the lifecycle of the activity that contains it.



1)Activity Created

onAttach(Activity): This is called when the fragment is associated with an activity.

onCreate(Bundle): It is very similar to the activity's onCreate() method.It can be used to do the initial setup of the fragment.

onCreateView(LayoutInflator, ViewGroup, Bundle): It uses LayoutInflator to inflate the layout of the fragment.

onActivityCreated(): It is called when the onCreate() method of the activity is
finished.

2)Activity Started

onStart(): It is called when the fragment is just about to become visible to the user.

3)Activity Resumed

onResume(): Called when it is visible to the user and he/she is interacting with the fragment.

4)Activity Paused

onPause(): Called when the fragment is no longer interacting with the user.

5)Activity Stopped

onStop(): Called when the activity is no longer visible to the user.

6)Activity destroyed

onDestroyView(): Gives fragment the chance to clear away any resources that were associated with its view.

onDestroy(): the fragment can clear away any other resources it created.

onDetach(): It is called when the fragment detaches from the activity. 

ST

Social

Recent

⬇⬇Get Your Link⬇⬇