Android Lifecycle: Is Onresume() Supposed To Be Called During Startup?
Solution 1:
onResume()
is called any time an activity is regaining the foreground input. This includes:
When it is returning to the screen after something else had the foreground (e.g., Settings), and
When it is being created for the first time in this process (which includes any new process required because you killed the old one from DDMS)
Hence, your code will examine the state of the ringer mode in either case and will use the proper image in either case.
Solution 2:
onResume isn't limited to being called after the activity has been paused, it's called whenever the activity goes to the top of the activity stack. That includes the first time it's shown after it's been created.
The developer doucmentation is quite detailed about how the actiivty lifecycle works, including a flowchart and table which describes when each lifecycle callback is actually called.
Solution 3:
I think you will find the recent updates to the Android developer documentation will clarify your answer. onResume() will be called anytime your activity starts for the first time, bring the activity to the foreground, or bring the phone out of the lock screen.
Solution 4:
onResume IS called at startup. Please refer to the the activity lifecycle documentation here.
Post a Comment for "Android Lifecycle: Is Onresume() Supposed To Be Called During Startup?"