开发者

How can I save state between orientations?

开发者 https://www.devze.com 2023-01-14 23:50 出处:网络
In a previous question I asked how I could display two d开发者_JAVA百科ifferent layouts for portrait and landscape 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

精彩评论

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