Advertisement
Guest User

Untitled

a guest
Jul 17th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. @Override
  2. protected void dispatchSaveInstanceState(SparseArray<Parcelable> container) {
  3. // Create a SparseArray just for us!
  4. SparseArray mySparseArray = new SparseArray(mChildrenCount + 1); // +1 for our ViewGroup's state.
  5.  
  6. // Repeat the normal logic for this method, but pass our "mySparseArray" instead of "container"
  7. super.dispatchSaveInstanceState(mySparseArray);
  8. final int count = mChildrenCount;
  9. final View[] children = mChildren;
  10. for (int i = 0; i < count; i++) {
  11. View c = children[i];
  12. if ((c.mViewFlags & PARENT_SAVE_DISABLED_MASK) != PARENT_SAVE_DISABLED) {
  13. c.dispatchSaveInstanceState(mySparseArray);
  14. }
  15. }
  16.  
  17. // Put mySparseArray in the container we were given.
  18. container.put(getId(), mySparseArray);
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement