应该是onPause()方法里面. 在Activity is running 的时候, 按下home后, 或者意外退出后, 就会经过onPause()方法,这时候保存数据和状态.
你可以看一下官方的文档对onPause()说明上面有这么一句话:
Called when the system is about to start resuming another activity. This method is typically used to commit unsaved changes to persistent data, stop animations and other things that may be consuming CPU, and so on. It should do whatever it does very quickly.
大概意思就是: 当系统开始恢复另一个活动。这种方法通常用于提交未保存的更改的持久化数据,停止动画和可能消耗CPU的其他东西,等等。它应该非常快.
官方文档都这么说了, 你还有什么好怀疑的...
|