Skip to content

karthi0292/LifeCycle

Repository files navigation

LifeCycle Of Activity

onCreate()
onStart()
onResume()
onPause()
onStop()
onDestroy()

Activity A navigates to Activity B

Activity A onPause()

Activity B onCreate()
Activity B onStart()
Activity B onResume()

Activity A onStop()

When back btn presses (return to Activity A)

Activity B onPause()

Activity A onRestart(), Activity A onStart(), Activity A onResume()

Activity B onStop(), Activity B onDestroy()

#LifeCycle of Fragment onAttach()
onCreate()
onCreateView()
onActivityCreated()
onPause()
onStop()
onDestroyView()
onDestroy()
onDetach()

When Activity B replace Fragment A by Fragment B without stack

Fragment A onPause()

Fragment B onAttach()
Fragment B onCreate()

Fragment A onStop()
Fragment A onDestroyView()
Fragment A onDestroy()
Fragment A onDetach()

Fragment B onCreateView()
Fragment B onActivityCreated()
Fragment B onStart()
Fragment B onResume()

When back btn presses from Fragment B

Fragment B onPause()
Activity B onPause()

Activity A onRestart()
Activity A onStart()
Activity A onResume()

Fragment B onStop()
Frgament B onDestroyView()
Frgament B onDestroy()
Fragment B onDetach()

Activity B onStop()
Activity B onDestroy()

When Activity B replace Fragment A by Fragment B with stack

Fragment A onPause()

Fragment B onAttach()
Fragment B onCreate()

Fragment A onStop()
Fragment A onDestroyView()

Fragment B onCreateView()
Fragment B onActivityCreated()
Fragment B onStart()
Fragment B onResume()

When back btn presses from Fragment B

Fragment B onPause()
Fragment B onStop()
Frgament B onDestroyView()
Frgament B onDestroy()
Fragment B onDetach()

Fragment A onCreateView()
Fragment A onActivityCreated()
Fragment A onStart()
Fragment A onResume()

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages