trong ứng dụng của tôi, tôi muốn lưu dữ liệu tại savedInstanceState()
. tôi muốn lưu ArrayList<HashMap<String,String>>
. Và cho đến nay tôi không thể làm điều đó. đây là mã của tôi mà làm phiền tôiLưu ArrayList of Hash map
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putParcelableArrayList("places", (ArrayList<? extends Parcelable>) places);
}
khôi phục phương pháp()
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
}
ohh Vâng cám ơn. nó Đã hoạt động –
Cảm ơn tôi! Ngoài ra chỉ cần thêm nếu bạn sử dụng onRestoreInstanceState bạn không phải làm kiểm tra null. http://developer.android.com/training/basics/activity-lifecycle/recreating.html – piratemurray