What is the difference in lifecycle between lock screen and opening other application android -
i'm developing application right now, problem when pressed home or open whatsapp notification , reopen application, restarted beginning of application, instead of resuming state left.
while locking , unlocking screen resumes state left.
so, tried tracing life-cycle between 2 process (locking screen & opening other app/home). makes me confuse both process show same lifecycle , onpause() , onstop() triggered when locked screen or open other app/home. then, when returned app, onrestart() , onresume() triggered.
if both shows same result, why locking screen , unlocking continued application, while pressing home or application , reopen application did not?
any solution or explanation appreciated. thanks.
code :
@override protected void onrestart(){ system.out.println("restart"); super.onrestart(); } @override protected void onresume(){system.out.println("resume"); gamepanel.resumeactivity(); super.onresume(); } @override protected void onpause(){ gamepanel.pausemusic(); gamepanel.pauseactivity(); system.out.println("pause"); super.onpause(); } @override protected void onstop(){ system.out.println("stop"); super.onstop(); } @override protected void ondestroy(){ content.removeview(gamepanel); content.removeview(edittext); gamepanel.stopmusic(); system.out.println("destroy"); super.ondestroy(); }
i think have use onsaveinstancestate(bundle savedinstancestate) achieve data @ time app destroyed. please take of that link, you.
Comments
Post a Comment