Activity life cycle question

ietv

Member
Licensed User
Longtime User
Using Erel's example in the Activity life cycle tutorial, if the Home button is pressed or a new activity is started, the activity is kept in memory.

Does that mean that, for example, the state of ToggleButtons is remembered?

Does that mean that the Activity_Create sub runs after the activity resumes? If Activity_Create does run, does Activity_Resume run first, or does Activity_Create run before Activity_Resume?

One other question: does Activity_Resume get called every time there is an event like a Click?
 
Last edited:

lagore

Active Member
Licensed User
Longtime User
Activity_Create will run before Activity_Resume on both first run of the app or when the app resumes from either screen rotation or when the app is pushed to the background and then brought to the foreground. The 'FirstTime' in Activity_Create is used to distinguish between the two. Use the Logs in the IDE to watch the life cycle in operation while the debugger is attached it makes it very clear. I think the only items that are remembered are those in Process_Globals while the process is in memory but in the background, once Android kills the app then the next time the app runs will be first time and everything starts fresh.
Activity_Resume is not called with a Click only the function that the Click Event is defined in.
Edward
 
Upvote 0

nfordbscndrd

Well-Known Member
Licensed User
Longtime User
Using Erel's example in the Activity life cycle tutorial, if the Home button is pressed or a new activity is started, the activity is kept in memory.

Does that mean that, for example, the state of ToggleButtons is remembered?

Does that mean that the Activity_Create sub runs after the activity resumes? If Activity_Create does run, does Activity_Resume run first, or does Activity_Create run before Activity_Resume?

One other question: does Activity_Resume get called every time there is an event like a Click?

All this is explained in detail at Tricks Of The Trade - Basic4android Wiki
 
Upvote 0

ietv

Member
Licensed User
Longtime User
Thanks, all. I will do the reading assignments tonight.

I was getting an Activity_Resume in my log when I had a click event. It looks like an intermittent problem, seems to be something with the focus using the emulator.
 
Upvote 0
Top