When a config change happens, my ListView Checkbox states get lost, which I understand why. I try to implement
public void onSaveInstanceState(final Bundle outState)
in one of my Fragments. So I'm just wondering what's the easiest way to store my SparseBooleanArray in the outState.
Also, I'm a bit confused, as ListView has the method:
getListView().getCheckedItemPositions();
What's this good for?
Extend SparseArray to implement a Serializable:
I am trying to do the same thing. Initially i was using a
HashMap
How to send hashmap value to another activity using an intent
to pass between activities since it extends the
Serializable
interface. However, after doing some research:"
SparseBooleanArrays
are intended to be more efficient than using aHashMap
to mapIntegers
toBooleans
."However, I can't find a simple way to store this data structure. I have contemplated grabbing the values of the
SparseBooleanArray
and storing it in aHashMap
so that it can be passed between activities. But this seems to add more complexity.Unfortunately, I think I am going to revert to using HashMaps to store my list of checked boxes