Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Commit

Permalink
getParcelableArray* behaviour is sometimes unpredictable
Browse files Browse the repository at this point in the history
in some case when the data in a savedInstance the Parcelable
arrays stored by the application are not unparcel'ed correctly
because the ClassLoader doesn't seem to be correct.

The first getSparseParcelableArray() in the code is preceded
by setClassLoader() by not the second one. The problem disappears
when setClassLoader() is called in both cases.

Change-Id: I2d2f42c285d9130fd543c0154e9d210d430823e3
  • Loading branch information
Steve Lhomme authored and Chris Banes committed Mar 28, 2014
1 parent a3ad01c commit 08ca9e8
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions v4/java/android/support/v4/app/FragmentManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -858,6 +858,7 @@ void moveToState(Fragment f, int newState, int transit, int transitionStyle,
case Fragment.INITIALIZING:
if (DEBUG) Log.v(TAG, "moveto CREATED: " + f);
if (f.mSavedFragmentState != null) {
f.mSavedFragmentState.setClassLoader(mActivity.getClassLoader());
f.mSavedViewState = f.mSavedFragmentState.getSparseParcelableArray(
FragmentManagerImpl.VIEW_STATE_TAG);
f.mTarget = getFragment(f.mSavedFragmentState,
Expand Down

0 comments on commit 08ca9e8

Please sign in to comment.