I understand that when the orientation of the screen changes, the current activities onDestroy() is called followed by the onCreate() to effectively recreate the activity.
I need to know how to programmatically tell if the application is being exited or if just the orientation is being changed.
One method is for the previous activity to notify me when its onResume() method is being called, this will let me know that the user has pressed the back button and the orientation hasn't been changed.
P.S. I'm looking for a solution more elegant than listening for a back hardware button click.
Here was what i wanted to do:
I have two tabs, when the activity is being entered for the first time or the user has left the activity and is now entering it, a certain tab is displayed based on some criterion.
When the orientation changes, i need to stay on the same tab.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…