在我的應用程序我想保存數據在savedInstanceState()
。我想保存ArrayList<HashMap<String,String>>
。到目前爲止,我無法做到這一點。 這裏是我的代碼是困擾我保存ArrayList的哈希映射
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putParcelableArrayList("places", (ArrayList<? extends Parcelable>) places);
}
恢復()方法
private void restore(Bundle savedInstanceState) {
// TODO Auto-generated method stub
//What should i do here! i have try many things but none of them is helping
}
喔以及感謝。它工作 – 2013-02-18 03:48:29
也感謝我!也只是添加,如果你使用onRestoreInstanceState你不必做空檢查。 http://developer.android.com/training/basics/activity-lifecycle/recreating.html – piratemurray 2014-11-03 21:15:09