Fragment Lifecycle

ANDROID › Lifecycle

Drills the fragment vs view lifecycle split, viewLifecycleOwner, leak-safe observation, and FragmentManager back stack.

Fragment lifecycle is a perennial interview filter because the fragment and its view have two separate lifecycles, and conflating them causes real production leaks and crashes. Interviewers probe whether you know the callback order, why you observe LiveData/Flow with viewLifecycleOwner, and how FragmentManager and the back stack cap a fragment's state. Expect to explain the activity-fragment mismatch and what happens to the view across configuration changes and back stack navigation.

What this covers

Study this topic

Further reading