If an activity (with WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD | FLAG_SHOW_WHEN_LOCKED | FLAG_TURN_SCREEN_ON) is launched while the screen is off, the order of activity lifecycle callbacks is: onCreate, onStart, onResume, onPause, onStop, onRestart, onStart, onResume Why does Android stop the activity and restart it?
I happenned to be calling finish() in onStop() (not realizing the above behavior) since I did not want to handle restart*. With this, the order of activity lifecycle callbacks is usually: onCreate, onStart, onResume, onPause, onStop However, once in a while, the order of callbacks is: onCreate, onStart, onResume, onPause, onStop, onRestart, ... This seems like a bug. If onStop calls finish(), it should not be followed by onRestart, right? Thanks, Shri * The activity displays a snapshot of the current state. If it can be restarted, it has to handle the case where the state has changed (which is doable, but a bit tricky) and update the UI to display the new state. I was attempting to simplify my logic by ensuring that the activity is never restarted so that I do not have to worry about a change in state. -- -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.