Questions tagged [lifecycle]

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.

2000 questions
17
votes
2 answers

What is correct lifecycle method in React 16.3 to update canvas from props?

I have a Canvas component, which looks approximately like this: class Canvas extends React.Component{ saveRef = node => { this._canvas = node; } shouldComponentUpdate(){ /*I will never re-render this…
Alex Fomin
  • 193
  • 3
  • 11
17
votes
7 answers

Does pressing Back always cause Activity to finish()?

I've heard that pressing the back button will essentially cause the current Activity to finish(). Is this always the case? Seems like it would be with the way it pops the Activity off the stack. The one situation I'm not so sure about is when the…
stormin986
  • 7,672
  • 15
  • 42
  • 54
17
votes
3 answers

Spring request scope bean

How can I set up a bean which will created once per request. I Tried to do like this : @Component @Scope(value = "request") public class TestBean { @PostConstruct public void init() { System.out.println("start…
john Smith
  • 1,565
  • 7
  • 34
  • 54
16
votes
7 answers

How can I know that OnResume comes after onCreate?

I have few activities and from one activity I open another and that go back to the first one... The point is onCreate is called ones , and onResume every time when the activity is show. For example when I close B that was previouslly started from A,…
Lukap
  • 31,523
  • 64
  • 157
  • 244
16
votes
1 answer

When Gradle's hooks are added in build lifecycle?

In Gradle there are plenty of hooks. But I can't understand exactly when they are applied. From the docs I found hooks for the build and for a…
Xelian
  • 16,680
  • 25
  • 99
  • 152
16
votes
4 answers

Android implementation of lifecycle methods can call the superclass implementation after doing any work?

In the Android documentation we have: Note: Your implementation of these lifecycle methods must always call the superclass implementation before doing any work... But I have seen cases where the code is placed after the superclass method,…
adrian4aes
  • 849
  • 2
  • 14
  • 23
16
votes
2 answers

Why would I ever want `setRetainInstance(false)`? - Or - The correct way to handle device rotation

Please correct me if I'm wrong on any of this. This is a kind of clarifying question since I haven't seen it explicitly written anywhere. In Android 4, you can call setRetainInstance(true) on a Fragment so that on configuration changes (which…
Timmmm
  • 88,195
  • 71
  • 364
  • 509
15
votes
1 answer

How do I setState within React's recompose's lifecycle method?

I am using recompose in my React project https://github.com/acdlite/recompose/ It's a great library. I'm using the compose utility as a container component that passes state down as props to the presentational component like so: const enhance =…
Mark Shust at M.academy
  • 6,300
  • 4
  • 32
  • 50
15
votes
1 answer

Vue 2.1 calling method in beforeCreate hook is not working

I am making an async call to some local json data before my component is created. So this code actually works fine: beforeCreate : function() { var self = this; fetch('/assets/data/radfaces.json') .then(function(response) {…
Amit Erandole
  • 11,995
  • 23
  • 65
  • 103
15
votes
5 answers

Which ASP.NET life cycle events fire after HttpApplication.Error?

I want to know which parts of the ASP.NET request life cycle happen after an error is handled via the HttpApplication.Error event. Specifically, which of the events listed at http://msdn.microsoft.com/en-us/library/bb470252.aspx#Stages fire after an…
William Gross
  • 2,083
  • 2
  • 17
  • 35
15
votes
2 answers

Android: application global onPause() and onResume()?

Is there something like an application global onPause() and onResume()? My main activity listens for GPS fixes, which I want to continue working when switching to another screen/activity. Therefor I cannot unregister my LocationListener in the…
znq
  • 44,613
  • 41
  • 116
  • 144
15
votes
4 answers

Android Application class method onCreate being called multiple times

i've overloaded the Application class in my android app and i'm using the ACRA report system. My app looks like ( real source code here ) : public class MyApplication extends Application { @Override public void onCreate() { …
Simone Margaritelli
  • 4,584
  • 10
  • 45
  • 70
14
votes
1 answer

aspectj-maven-plugin not covered by lifecycle in Kepler

I've just downloaded the OEPE (Kepler) and installed m2e and m2e-wtp connectors. I found out that under this path: Preferences ->Maven->Lifecycle mappings->Open workspace lifecycle mapping data there is a preconfigured xml file which says that maven…
LAC
  • 852
  • 4
  • 11
  • 31
13
votes
2 answers

mounted method is fired before data loaded - VueJS

I'm using Vue Resource to retrieve an images collection from a REST API. The request is sent in the created hook of my Vue component. The problem is, I'm trying to access the retrieved data in the mounted hook, but the data isn't loaded. I get…
BrownBe
  • 977
  • 3
  • 11
  • 23
13
votes
1 answer

Angular LifecyleHooks and when is @ViewChild valid?

I am a bit perplexed. I thought I basically understood the lifecycle of angular components, but THEN I ran into an interesting case, where the @Input of a component was undefined. In this case, I have TWO instances of my application. The given…
JoelParke
  • 2,676
  • 2
  • 24
  • 38