Tuesday, July 31, 2012

[android-developers] onSaveInstance state in activity and fragments

I have an activity which contains 2 fragments. I want to save certain state of the activity and also of the fragments, in order to restore if the activity, or the fragments, are destroyed.

So I'm using onSaveInstanceState both in the fragments and in the activity, and take the data of the bundle passed to onCreate or onCreateView.

This works well besides, when the activity is destroyed. Then in restores it's own data, but, since in onCreate() I instantiate the adapter and the fragments again, they get no state.

How do I solve this?

Thanks in advance.

You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
For more options, visit this group at

No comments:

Post a Comment