This sounds suspiciously like the issue I am having
http://groups.google.com/group/android-developers/browse_thread/thread/ca3a0c174d284263

I was able to reproduce the bug with pushing a new activity in my own
app, which uses an AsyncTaskLoader instead of a CursorLoader.

Hopefully somebody familiar with the Fragment/FragmentManager/Loader/
LoaderManager code will reply to one (or both) of these threads with
some additional insight.  I'm planning to enter a bug/issue in the
next day or two if I do not hear anything to the contrary.

You may want to try setting a breakpoint around the time you call
initLoader, and see if the LoaderManager's mDestroyed member is true.
This is what led me to believe that the issue is with the lifetime
management of the loader manager.

On Oct 7, 6:29 am, kaciula <[email protected]> wrote:
> I have a simple activity with one fragment. The fragment uses a CursorLoader
> to load some data from a ContentProvider. I just call initLoader() inside
> onActivityCreated() and I populate the UI in onLoadFinished(). If I switch
> orientations, everything works as expected (onLoadFinished() is called
> again).
>
> Now, if I move to a new activity, press BACK to get back to my first
> activity and then switch orientations, I see that onLoaderReset() is called
> and then, in onActivityCreated(), although initLoader() is called,
> onLoadFinished() is never called after that. And as a consequence, my UI
> shows no data.
>
> After doing some testing, I see that this problem appears only if I use
> setRetainInstance(true) in my fragment. So what's the deal? And how can I
> fix this without removing setRetainInstance(true)? Do I have to do something
> in onLoaderReset()? Do I have to somehow give the loader the new activity as
> the context?
>
> Thanks.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to