0

I am quite new in Android. So, please help me this question. I have Fragment which I show to user an Email. I put the email content to a Model Object. Should I put the model object to the bundle in onSaveInstanceState method or how can I persist the model object for Fragment recreate ?

Maybe it is a simple question but please help me.

Daniel
  • 23,129
  • 12
  • 109
  • 154
kdtphdav
  • 225
  • 2
  • 4
  • 10

1 Answers1

0

If you want to save the object in a bundle, it should be a parcelable object. You can use putParcelable and getParcelable for saving and restoring object. Usually it's discouraged to save large data since it will make recreation slower. Only save what you absolutely need.

Gautham
  • 3,418
  • 3
  • 30
  • 41