Tuesday, 27 February 2018

Activity LifeCycle

➤onCreate() — Called when the activity is first created
 ➤onStart() — Called when the activity becomes visible to the user
 ➤onResume() — Called when the activity starts interacting with the user
➤onPause() — Called when the current activity is being paused and the previous activity is being resumed
➤onStop() — Called when the activity is no longer visible to the user
➤onDestroy() — Called before the activity is destroyed by the system (either manually or by the system to conserve memory)
➤onRestart() — Called when the activity has been stopped and is restarting again

onclick of home btn which method called?
onpause onSaveInstanceState and onstop and then onresume
Restart the app after pressing home
onRestart
onStart
onResume


on backpressed?
onPause
onStop
onDestroy
onSaveInstanceState was not called, because there is no current state to resume – when you re-enter you will be back at the beginning
Restart the app after pressing back
onCreate
onStart
onResume

Turn off with the power button
onSaveInstanceState
onPause
 
When the phone was suspended, onSaveInstanceState and onPause were called in different orders, and onStop was called in some cases.
Turn on with the power button
onResume

from one activity to other-
when onrestart is called?
go from act1 to act 2 and when you come back from act2 to act1 on restart-- onstart--on resume is called

 

No comments:

Post a Comment

Pass a HashMap from Angular Client to Spring boot API

This example is for the case where fileData is very huge and in json format   let map = new Map<string, string>()      map.set(this.ge...