It is the default action of the system to retain the activity status when the activity is terminated. In this way, when the user returns to the previous activity, the user interface will display the way they left. However, in the scenario where the activity is destroyed or rebuilt, the callback method should be used to retain the activity status.
When the system terminates an activity (for example, when a new activity is started or the task is transferred to the background), if the system memory needs to be recycled, the system may completely destroy the activity. When this happens, information about the activity status is lost. Even if this happens, the system still knows the position of the activity in the rollback stack, but when the activity is taken to the top of the stack, the system must re-create it (instead of restoring it ). To avoid losing users' work, you should actively retain the status information in the activity by implementing the onsaveinstancestate () callback method.
For more information about how to save the activity status, see the activities documentation.