android - Why is onSaveInstanceState called when starting new activity? -


why onsaveinstancestate called when starting new activity startactivity(intent), when user presses or home new activity, onrestoreinstancestate not called?

when navigate activity activity b, activity have onsaveinstancestate() method invoked in case activity destroyed (because system needs free resources).

when navigate activity b activity a, there few different paths code can take. if activity still , running, resume (and you'll see onresume() called). if instead activity destroyed system while on activity b, activity need recreated. you'll see oncreate() called system (and param savedinstancestate non-null , populated put in onsaveinstancestate()) other lifecycle methods happen "after" oncreate().


Comments

Popular posts from this blog

javascript - Replicate keyboard event with html button -

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Web audio api 5.1 surround example not working in firefox -