【问题标题】:How to save the state of Spinner in onSaveInstanceState when changing the orientation in android如何在android中更改方向时将Spinner的状态保存在onSaveInstanceState中
【发布时间】:2011-02-07 09:09:04
【问题描述】:

我想在更改方向时保存绑定到适配器的微调器的状态(即内容)。我正在使用 onSaveInstanceState(Bundle savedInstanceState) 和 onRestoreInstanceState(Bundle savedInstanceState) 方法。 您会逐步说明如何保存内容吗?

感谢

【问题讨论】:

    标签: android


    【解决方案1】:

    这是一个很好的例子来说明如何做到这一点(查看 onPause 和 onResume)Spinner Example。我强烈建议还添加活动测试(也称为单元测试),以确保您恢复生命周期中的所有状态。 unit test example.

    【讨论】:

    • 我在 Android API 16+ 中找不到 Spinner 示例。
    猜你喜欢
    • 2015-11-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-04-09
    • 1970-01-01
    相关资源
    最近更新 更多