【发布时间】:2016-07-24 08:32:45
【问题描述】:
在技术上我应该使用onRestoreInstanceState 有什么理由吗?我不能通过检查savedInstanceState 捆绑包是否为空来完成onCreate 中的所有恢复吗?与 onCreate 中的所有操作相比,使用 onRestoreInstanceState 的主要好处是什么?
【问题讨论】:
-
这里有很好的解释:stackoverflow.com/a/14676555/2278598
-
@AndrewBrooke 我不明白
"So for best practice, lay out your view hierarchy in onCreate and restore the previous state in onRestoreInstanceState"这条线。这是否意味着只分配视图(例如通过findViewById),然后分配onRestoreInstanceState中的成员变量?