saving ArrayList in the bundle savedInstanceState

android

Solution

When you use `onRestoreInstanceState()` to restore state, its called after `onStart()` so you update your list with the saved state after you define your adapter. Your best option is to restore the list in `onCreate()` the same way you do it on `onRestoreInstanceState()`. You can also redefine the adapter or call `notifyDataSetChanged()`.

Problem

the ArrayList is defined on class level. these are my savedInstance methods: ``` @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putStringArrayList("savedList", list); } @Override protected void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); list=savedInstanceState.getStringArrayList("savedList"); } ``` but still, when i change orientation the ArrayList is blank

Original source

Related problems