Android的碎片onRestoreInstanceState碎片、Android、onRestoreInstanceState

2023-09-12 07:10:23 作者:十言九忘

我缺少的东西或做片段不是有一个 onRestoreInstanceState()的方法?如果不是,我怎么去实现类似的东西?

Am I missing something or do Fragments not have a onRestoreInstanceState() method? If not, how do I go about attaining something similar?

推荐答案

片段没有一个 onRestoreInstanceState 方法。

您也可以达到同样的结果在 onActivityCreated ,它接收一个包与保存的实例状态(或空)。

You can achieve the same result in onActivityCreated, which receives a bundle with the saved instance state (or null).

这里检查源$ C ​​$ C 。

Check the source code here.