-1

Activity inside viewpage, I have to set up the adapter, and save the data, the code is probably as follows:

List <Fragment> mFragments = new ArrayList <> ();
mFragments.add (AFragment);
mFragments.add (BFragment);
mFragments.add (CFragment);

onSaveInstanceState () inside the code below:

bundle.putSerializable ("key", (Serializable) mFragments);

This time I switch the screen orientation onSaveInstanceState method call, whether it is saving data or restore data are normal.

But I am now in the interior of A, B, C just a fragment starts the camera to take pictures, that they will report Parcel: unable to marshal value AFragment {6afa2b} this error. After lookup is calling onSaveInstanceState() inside bundle.putSerializable ("key", (Serializable) mFragments); sentence being given.

I do not know why not? Great god who seek help ah.

alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195

1 Answers1

0

Fragment does not implement Serializable. If you need to persist a Fragment, use FragmentManager.putFragment(), you can read more here.

Community
  • 1
  • 1
telkins
  • 10,440
  • 8
  • 52
  • 79