开发者

How can I save state between orientations?

In a previous question I asked how I could display two d开发者_JAVA百科ifferent layouts for portrait and landscape orientations:

Problem switching to landscape orientation

Now I would like to know how I can save the state of my application before it goes into another orientation? I seem to lose this data any time orientation changes.


This kind of quesiton has been answered before.

But there are also other ways not listed in the previous answer. For example using the onRestoreInstanceState() method, as explained here. This method is the advised way of storing state between configuration changes, and was poorly documented until recently.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜