0

我必须在方向更改时保存多个整数数组如何做到这一点。这是我看到的保存一个值的代码。

@Override​
​​​​public ​void​ onSaveInstanceState(Bundle ​outState)​ {
​​​​​​​​//--- save​ what ever​ you​ need ​to ​persist ---
​​​​​​​​outState.putString("ID", "1234567890");
​​​​​​​​super.onSaveInstanceState(outState);
​​}

@Override
​​​​public ​void​ onRestoreInstanceState(Bundle ​savedInstanceState)​ {
 ​​​​​​​​super.onRestoreInstanceState(savedInstanceState);
 String ​ID​ = ​savedInstanceState.getString("ID");

      }
4

1 回答 1

0

阅读 Bundle 文档:http: //developer.android.com/reference/android/os/Bundle.html

于 2013-07-27T20:56:21.340 回答