如何保存捆绑包?
哪一个更好地保存 Bundle:OnSaveInstanceState 或 OnPause 以便在旋转和重绘包含已修改图像的 GridView 时保存 Bundle?
Which one is better to save Bundle: OnSaveInstanceState or OnPause in order to save Bundle in case or rotation and redrawing of a GridView containing images that have been modified?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
每当您的 Activity 失去前台状态时,就会调用
onPause()
,随后当它进入前台时,就会调用其对应的onResume()
。因此,您可以在此处检查与 UI 相关的信息(例如更新)。onSaveInstanceState()
是您应该保存 Bundle 的位置。可以在onCreate()
或onRestoreInstanceState()
中检索您的包(活动状态信息)。onPause()
is called whenever your activity loses it's foreground status, and subsequently when it comes to the foreground, it's counterpartonResume()
is called. So, this is where you would check your UI-related information (eg. updating).onSaveInstanceState()
is where you should save your Bundle. The retrieval of your bundle (activity state info) can be done in eitheronCreate()
oronRestoreInstanceState()
.