A sequence of events or system calls relevant to the creation, startup, inactivation, resuming, shutdown and destruction (cleanup) of some program or its component (activity, library, servlet). Lifecycles are supported by various programming platforms.
Questions tagged [lifecycle]
2000 questions
67
votes
9 answers
Is there any lifecycle hook like window.onbeforeunload in Angular2?
Is there any lifecycle hook like window.onbeforeunload in Angular2?
I already googled and searched on stackoverflow, but found nothing

Dieter Köberl
- 701
- 2
- 6
- 16
65
votes
4 answers
Android Application Class Lifecycle
The android app I am working on overrides the Application class to store lightweight state (username, gps location, etc) in static vars. Most of this state is set in OnCreate of the launch activity (username retrieved from prefs, location listener…

Patrick Cullen
- 8,654
- 3
- 21
- 23
62
votes
6 answers
react lifecycle methods understanding
I am a newbie to React.js and I am trying hard to understand several methods in the React lifecycle methods.
So far, I have something that confuses me:
1)
As far as I understand, the difference between componentWillUpdate and…

Guifan Li
- 1,543
- 5
- 14
- 28
60
votes
2 answers
What is the lifecycle of a service in Angular 5
Angular 5
When is a service created and destroyed, what are its lifecycle hooks (if any) and how is its data shared between components?
EDIT: To clarify, this is NOT a question about the lifecycle of components. This question is about the lifecycle…

rahs
- 1,759
- 2
- 15
- 31
55
votes
5 answers
How to test code built to save/restore Lifecycle of an Activity?
How can I test all of the following methods code? I want to play scenarios when all of them are happening to see if my code works for save/restore process of an activity. So what should I do in the Emulator to get all methods tested?
public class…

Pentium10
- 204,586
- 122
- 423
- 502
54
votes
4 answers
How to distinguish between orientation change and leaving application android
I understand that when the orientation of the screen changes, the current activities onDestroy() is called followed by the onCreate() to effectively recreate the activity.
I need to know how to programmatically tell if the application is being…

Dustfinger
- 1,013
- 1
- 18
- 27
49
votes
7 answers
Videoview Pausing and resuming
I am new to android development and I am programming a game. My game has cutsceens that play before each level starts, cutsceens which are done through videoview. My problem is, that upon an application pause, the cutsceen starts from the beginning…

Athos
- 681
- 2
- 7
- 14
48
votes
3 answers
How can I atomically run mvn tests (without rebuilding source code)?
I want to run a maven project lifecycle starting, and ending, with the unit tests.
How can I skip recompilation and re-resolution of dependencies and only run the test phase?

jayunit100
- 17,388
- 22
- 92
- 167
48
votes
6 answers
JSF skip Required-Validation without immediate=true
I have multiple forms, where I have mandatory fields and optional fields.
To submit such a form I require the validation on the required-attribute to be executed, which works fine.
To cancel such a form I use the attribute immediate="true" on the…

dognose
- 20,360
- 9
- 61
- 107
46
votes
6 answers
onResume() and onPause() for widgets on Flutter
Right now, a widget only has initeState() that gets triggered the very first time a widget is created, and dispose(), which gets triggered when the widget is destroyed. Is there a method to detect when a widget comes back to the foreground? and when…

user3217522
- 5,786
- 7
- 26
- 34
45
votes
3 answers
Application_End global.asax
Can anybody tell me when Application_End is triggered in a lifecycle of an application? When all sessions are ended, will Application_End be triggered automatically? + Are there any other reasons why Application_End could be triggered?

Lieven Cardoen
- 25,140
- 52
- 153
- 244
44
votes
4 answers
Cancel All Subscriptions and Asyncs in the componentWillUnmount Method, how?
I'm getting an error message due to an async method issue. In my terminal I'm seeing:
Warning: Can't call setState (or forceUpdate) on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all…

Dres
- 1,449
- 3
- 18
- 35
43
votes
4 answers
How does browser page lifecycle sequence work?
Would like to create a presentation on how the browser work, does anybody know the exact lifecycle sequence which happen whenever a browser URL is requested?
What are the steps which happen after a response is received from the server in terms of :…
user4602228
42
votes
6 answers
Lifecycle OnLifecycleEvent is deprecated
After updating lifecycle library to 2.4.0 Android studio marked all Lifecycle events as deprecated.
@OnLifecycleEvent(Lifecycle.Event.ON_CREATE)
fun create() {
tts = TextToSpeech(context, this)
}
@OnLifecycleEvent(Lifecycle.Event.ON_PAUSE)
fun…

Vahe Gharibyan
- 5,277
- 4
- 36
- 47
38
votes
4 answers
Automatically log Android lifecycle events using ActivityLifecycleCallbacks?
I am trying to automatically capture and log Android lifecycle events using ActivityLifecycleCallbacks, however documentation on this matter is scarce, to say the least:
public void registerActivityLifecycleCallbacks…

AWT
- 3,657
- 5
- 32
- 60