Skip to content

Instantly share code, notes, and snippets.

@matthew-carroll
Created July 6, 2019 10:56
Show Gist options
  • Save matthew-carroll/036f0bd040b0c75594d4a46ad7d3c755 to your computer and use it in GitHub Desktop.
Save matthew-carroll/036f0bd040b0c75594d4a46ad7d3c755 to your computer and use it in GitHub Desktop.
Implementing of dispatchSaveInstanceState() in ViewGroup for Android.
@Override
protected void dispatchSaveInstanceState(SparseArray<Parcelable> container) {
super.dispatchSaveInstanceState(container);
final int count = mChildrenCount;
final View[] children = mChildren;
for (int i = 0; i < count; i++) {
View c = children[i];
if ((c.mViewFlags & PARENT_SAVE_DISABLED_MASK) != PARENT_SAVE_DISABLED) {
c.dispatchSaveInstanceState(container);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment