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
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?
精彩评论