Reputation: 956
I'm pretty new in developing android apps and I have a hard time to understand the app/activity/class lifecycle.
I have two activities: MainActivity
and DetailActivity
. Each one has it's own Fragments
.
There is a StatusController
singleton between them, which implements the observer pattern
.
I read about that android kills apps when it needs memory. So here are my questsions:
Upvotes: 1
Views: 469
Reputation: 4678
Here are your answers:
Android OS kills whole process rather killing an individual activity. Process kills mean your app will not running any more
No it is not possible that acitivity is called but fragments survive because fragments are loaded over activity and fragment lifecycle is dependents on fragment.Once activity is destroyed fragment will no longer be visible anymore
Is there anywhere a documentation about what gets killed on memory leak? When do singleton classes get killed?
When you kill your app singleton classes will be killed. NOTE: If OS kills the process in which your app is running in that case all Singleton classes will be killed
NOTE: For memory leak documentation you may refer below mentioned link. https://mindorks.com/blog/detecting-and-fixing-memory-leaks-in-android
Upvotes: 1