Simulate killing of activity in emulator

前端 未结 7 1980
误落风尘
误落风尘 2020-12-01 06:26

I would like to test out onSaveInstanceState and onRestoreInstanceState for my app on the emulator.

I have found this, which says that we c

相关标签:
7条回答
  • 2020-12-01 07:22

    You can use the setting "Don't keep activities" in developer settings or kill the app process by yourself.

    To kill the process, open the activity you want to test, then press home button to send your app to background, and then, using the DDMS in Android Studio (Android Device Monitor), select the process and then stop the process (as seen in the image below). Your app was killed. Now, open your app again (accessing the list of open apps). Now you can test the killed state.

    0 讨论(0)
提交回复
热议问题