关于onSaveInstanceState的一个问题

在《android源码设计模式解析与实战》这本书中,写到关于onSaveInstanceState这一章,里面说从activityA中启动一个新的activityB时 onSaveInstanceState会被调用,而某个activity跳转到其他activity则不会调用?????
啥意思?

#安卓工程师#
全部评论
肯定也会调用啊
点赞 回复 分享
发布于 2016-08-09 20:31
API里面这么说的: This method is called before an activity may be killed so that when it comes back some time in the future it can restore its state. For example, if activity B is launched in front of activity A, and at some point activity A is killed to reclaim resources, activity A will have a chance to save the current state of its user interface via this method so that when the user returns to activity A, the state of the user interface can be restored via  onCreate(Bundle)  or  onRestoreInstanceState(Bundle) . 也就是在销毁一个Activity之前调用,估计书中说的“ 启动 ”是先finish再startActivity,跳转直接就是startActivity,这样就能说的通了。
点赞 回复 分享
发布于 2016-08-09 17:53

相关推荐

12-24 14:26
东北大学 Java
一只乌鸦:重邮+东北,好经典的学校
最后再改一次简历
点赞 评论 收藏
分享
代码飞升_不回私信人...:别这样贬低自己,降低预期,放平心态,跟昨天的自己比。做好自己,反而会效率更高心态更好,加油兄弟
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务