1

I have an application that works without fragments. I modified an activity to use fragments. The problem is that now when the activity goes in background and then in foreground again the onCreate is called: it looks like the activity gets killed to save memory or for another reason.

I tried to save a bundle in onSaveInstanceState but when the activity is opened again I receive a null bundle in the onCreate and no call to onRestoreInstanceState (I checked that I receive a call to onSaveInstanceState when going in background).

Any clue?

thanks

kingston
  • 11,053
  • 14
  • 62
  • 116
  • I found the same beaviour with SDK 2.3 (SonyEricsson Xperia) and 3.0 (Motorola Xoom). – kingston Nov 26 '11 at 22:03
  • did you find the reason (or even a solution) for this behaviour in the meantime? I'm facing the same problem... – prom85 Feb 26 '14 at 21:08

1 Answers1

0

I recently updated my first application to use Fragments. I create the bundle in onSaveInstanceState and then I retrieve the bundle in onActivityCreated. Both methods are in the Fragment derived class! Maybe you're creating the bundle in the Fragment and then trying to retrieve it in the Activity?

type-a1pha
  • 1,891
  • 13
  • 19