It's a alternative to simulate "kill activity" by the Immediately destroy activities (or called Don't keep activities/Do not keep activities) selection Development Settings:
Select Developer options in Setting |
According to the Android Developer document of Using the Dev Tools App:
Immediately destroy activities
Tells the system to destroy an activity as soon as it is stopped (as if Android had to reclaim memory). This is very useful for testing the onSaveInstanceState(Bundle) / onCreate(android.os.Bundle) code path, which would otherwise be difficult to force. Choosing this option will probably reveal a number of problems in your application due to not saving state. For more information about saving an activity's state, see the Activities document.
Notice: This setting for developers only, NOT for general user.
Related: The lifecycle in Activity Killed